kernel_optimize_test/include/scsi
Bart Van Assche 8e6882545d scsi: Avoid that scsi_exit_rq() triggers a use-after-free
Dereferencing shost from scsi_exit_rq() is not safe because the SCSI
host may already have been freed when scsi_exit_rq() is called.
Increasing the shost reference count in scsi_init_rq() and dropping that
reference in scsi_exit_rq() is nontrivial since scsi_host_dev_release()
may sleep and since scsi_exit_rq() may be called from interrupt
context. Since scsi_exit_rq() only needs a single bit from shost, copy
that bit into struct scsi_cmnd.

Reported-by: Scott Bauer <scott.bauer@intel.com>
Fixes: e9c787e65c ("scsi: allocate scsi_cmnd structures as part of struct request")
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Scott Bauer <scott.bauer@intel.com>
Cc: Jan Kara <jack@suse.cz>
Cc: <stable@vger.kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-06-12 20:55:58 -04:00
..
fc uapi: export all headers under uapi directories 2017-05-11 00:21:54 +09:00
fc_encode.h
fc_frame.h
fcoe_sysfs.h
iscsi_if.h
iscsi_proto.h linux: drop __bitwise__ everywhere 2016-12-16 00:13:41 +02:00
iser.h
libfc.h scsi: libfc: convert fc_fcp_pkt.ref_cnt from atomic_t to refcount_t 2017-03-15 18:44:02 -04:00
libfcoe.h fcoe: implement FIP VLAN responder 2016-07-20 19:49:41 -04:00
libiscsi_tcp.h
libiscsi.h SCSI misc on 20170503 2017-05-04 12:19:44 -07:00
libsas.h scsi: sas: remove sas_domain_release_transport 2017-04-04 20:16:38 -04:00
osd_attributes.h
osd_initiator.h
osd_ore.h
osd_protocol.h
osd_sec.h
osd_sense.h
osd_types.h
sas_ata.h
sas.h
scsi_bsg_iscsi.h
scsi_cmnd.h scsi: Avoid that scsi_exit_rq() triggers a use-after-free 2017-06-12 20:55:58 -04:00
scsi_common.h
scsi_dbg.h
scsi_device.h SCSI misc on 20170503 2017-05-04 12:19:44 -07:00
scsi_devinfo.h
scsi_dh.h
scsi_driver.h scsi: scsi_error: count medium access timeout only once per EH run 2017-04-06 13:07:32 -04:00
scsi_eh.h scsi: Improve scsi_get_sense_info_fld 2017-04-25 13:00:56 -04:00
scsi_host.h scsi: make asynchronous aborts mandatory 2017-04-06 13:07:33 -04:00
scsi_ioctl.h
scsi_proto.h target: Add WRITE_VERIFY_16 2017-05-01 22:21:40 -07:00
scsi_request.h scsi: introduce a result field in struct scsi_request 2017-04-20 12:16:10 -06:00
scsi_tcq.h
scsi_transport_fc.h scsi: scsi_transport_fc: Add dummy initiator role to rport 2017-04-19 19:13:52 -04:00
scsi_transport_iscsi.h
scsi_transport_sas.h scsi: sas: remove is_sas_attached() 2016-08-18 22:23:20 -04:00
scsi_transport_spi.h
scsi_transport_srp.h scsi: remove tsk_mgmt_response and it_nexus_response transport methods 2017-02-06 19:10:41 -05:00
scsi_transport.h SCSI misc on 20170220 2017-02-21 11:51:42 -08:00
scsi.h scsi: remove useless acpi functions in the header file 2017-01-10 23:13:58 -05:00
scsicam.h
sg.h scsi: sg: disable SET_FORCE_LOW_DMA 2017-04-11 20:55:20 -04:00
srp.h
viosrp.h ibmvscsis: Initial commit of IBM VSCSI Tgt Driver 2016-07-20 01:15:43 -07:00