nvme-loop: fix kernel oops in case of unhandled command
authorMing Lei <ming.lei@redhat.com>
Thu, 12 Apr 2018 15:16:04 +0000 (09:16 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 21 Nov 2018 08:24:17 +0000 (09:24 +0100)
commita8ba76fc043e1a34e98055f6e818c67ddc3c05c2
tree4d68be3d3e8236ee0f3fd0df8f777e1885c79c84
parentc9b8d580b3fb0ab65d37c372aef19a318fda3199
nvme-loop: fix kernel oops in case of unhandled command

commit 11d9ea6f2ca69237d35d6c55755beba3e006b106 upstream.

When nvmet_req_init() fails, __nvmet_req_complete() is called
to handle the target request via .queue_response(), so
nvme_loop_queue_response() shouldn't be called again for
handling the failure.

This patch fixes this case by the following way:

- move blk_mq_start_request() before nvmet_req_init(), so
nvme_loop_queue_response() may work well to complete this
host request

- don't call nvme_cleanup_cmd() which is done in nvme_loop_complete_rq()

- don't call nvme_loop_queue_response() which is done via
.queue_response()

Signed-off-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
[trimmed changelog]
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/nvme/target/loop.c