On Tue, 2019-04-09 at 17:02 -0700, Jaesoo Lee wrote: +AD4 When SCSI blk-mq is enabled, there is a bug in handling errors in scsi+AF8-queue+AF8-rq. +AD4 Specifically, the bug is not setting result field of scsi+AF8-request correctly when +AD4 the dispatch of the command has been failed. Since the upper layer code +AD4 including the sg+AF8-io ioctl expects to receive any error status from result field +AD4 of scsi+AF8-request, the error is silently ignored and this could cause data +AD4 corruptions for some applications. +AD4 +AD4 Signed-off-by: Jaesoo Lee +ADw-jalee+AEA-purestorage.com+AD4 +AD4 --- +AD4 drivers/scsi/scsi+AF8-lib.c +AHw 6 +-+-+-+-+-- +AD4 1 file changed, 5 insertions(+-), 1 deletion(-) +AD4 +AD4 diff --git a/drivers/scsi/scsi+AF8-lib.c b/drivers/scsi/scsi+AF8-lib.c +AD4 index 2018967..dc2550c 100644 +AD4 --- a/drivers/scsi/scsi+AF8-lib.c +AD4 +-+-+- b/drivers/scsi/scsi+AF8-lib.c +AD4 +AEAAQA -1699,8 +-1699,12 +AEAAQA static blk+AF8-status+AF8-t scsi+AF8-queue+AF8-rq(struct +AD4 blk+AF8-mq+AF8-hw+AF8-ctx +ACo-hctx, +AD4 ret +AD0 BLK+AF8-STS+AF8-DEV+AF8-RESOURCE+ADs +AD4 break+ADs +AD4 default: +AD4 +- if (unlikely(+ACE-scsi+AF8-device+AF8-online(sdev))) +AD4 +- scsi+AF8-req(req)-+AD4-result +AD0 DID+AF8-NO+AF8-CONNECT +ADwAPA 16+ADs +AD4 +- else +AD4 +- scsi+AF8-req(req)-+AD4-result +AD0 DID+AF8-ERROR +ADwAPA 16+ADs +AD4 /+ACo +AD4 - +ACo Make sure to release all allocated ressources when +AD4 +- +ACo Make sure to release all allocated resources when +AD4 +ACo we hit an error, as we will never see this command +AD4 +ACo again. +AD4 +ACo-/ Should +ACI-Fixes:+ACI and +ACI-Cc: stable+ACI tags be added to this patch? Anyway: Reviewed-by: Bart Van Assche +ADw-bvanassche+AEA-acm.org+AD4