aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mpi3mr
diff options
context:
space:
mode:
authorTony Battersby <tonyb@cybernetics.com>2022-07-11 10:51:32 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2022-07-18 22:33:04 -0400
commit3455607fd7be10b449f5135c00dc306b85dc0d21 (patch)
tree123d7c365c6918c70eea96a6f6156b8a9f8563cd /drivers/scsi/mpi3mr
parentscsi: qla2xxx: Update version to 10.02.07.800-k (diff)
downloadlinux-dev-3455607fd7be10b449f5135c00dc306b85dc0d21.tar.xz
linux-dev-3455607fd7be10b449f5135c00dc306b85dc0d21.zip
scsi: sg: Allow waiting for commands to complete on removed device
When a SCSI device is removed while in active use, currently sg will immediately return -ENODEV on any attempt to wait for active commands that were sent before the removal. This is problematic for commands that use SG_FLAG_DIRECT_IO since the data buffer may still be in use by the kernel when userspace frees or reuses it after getting ENODEV, leading to corrupted userspace memory (in the case of READ-type commands) or corrupted data being sent to the device (in the case of WRITE-type commands). This has been seen in practice when logging out of a iscsi_tcp session, where the iSCSI driver may still be processing commands after the device has been marked for removal. Change the policy to allow userspace to wait for active sg commands even when the device is being removed. Return -ENODEV only when there are no more responses to read. Link: https://lore.kernel.org/r/5ebea46f-fe83-2d0b-233d-d0dcb362dd0a@cybernetics.com Cc: <stable@vger.kernel.org> Acked-by: Douglas Gilbert <dgilbert@interlog.com> Signed-off-by: Tony Battersby <tonyb@cybernetics.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/mpi3mr')
0 files changed, 0 insertions, 0 deletions