]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - drivers/scsi/scsi_lib.c
scsi: core: set result when the command cannot be dispatched
authorJaesoo Lee <jalee@purestorage.com>
Wed, 10 Apr 2019 00:02:22 +0000 (17:02 -0700)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commit687dbe30cb4ccabbd8cfd8d982c639ae5c09f0c5
treeefd6ce3f1eeed42f85a52c605250c992f56e5b33
parenta1ca0fe3015193e55880577b5dd63b4d66079a61
scsi: core: set result when the command cannot be dispatched

BugLink: https://bugs.launchpad.net/bugs/1838349
commit be549d49115422f846b6d96ee8fd7173a5f7ceb0 upstream.

When SCSI blk-mq is enabled, there is a bug in handling errors in
scsi_queue_rq.  Specifically, the bug is not setting result field of
scsi_request correctly when the dispatch of the command has been
failed. Since the upper layer code including the sg_io ioctl expects to
receive any error status from result field of scsi_request, the error is
silently ignored and this could cause data corruptions for some
applications.

Fixes: d285203cf647 ("scsi: add support for a blk-mq based I/O path.")
Cc: <stable@vger.kernel.org>
Signed-off-by: Jaesoo Lee <jalee@purestorage.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/scsi/scsi_lib.c