]> git.itanic.dy.fi Git - linux-stable/commit
nvmet: fix a use-after-free
authorBart Van Assche <bvanassche@acm.org>
Fri, 12 Aug 2022 21:03:17 +0000 (14:03 -0700)
committerChristoph Hellwig <hch@lst.de>
Mon, 5 Sep 2022 13:03:51 +0000 (15:03 +0200)
commit6a02a61e81c231cc5c680c5dbf8665275147ac52
tree2bb4988c6ca212365a725024f05d9d99a0f887fa
parent748008e1da926a814cc0a054c81ca614408b1b0c
nvmet: fix a use-after-free

Fix the following use-after-free complaint triggered by blktests nvme/004:

BUG: KASAN: user-memory-access in blk_mq_complete_request_remote+0xac/0x350
Read of size 4 at addr 0000607bd1835943 by task kworker/13:1/460
Workqueue: nvmet-wq nvme_loop_execute_work [nvme_loop]
Call Trace:
 show_stack+0x52/0x58
 dump_stack_lvl+0x49/0x5e
 print_report.cold+0x36/0x1e2
 kasan_report+0xb9/0xf0
 __asan_load4+0x6b/0x80
 blk_mq_complete_request_remote+0xac/0x350
 nvme_loop_queue_response+0x1df/0x275 [nvme_loop]
 __nvmet_req_complete+0x132/0x4f0 [nvmet]
 nvmet_req_complete+0x15/0x40 [nvmet]
 nvmet_execute_io_connect+0x18a/0x1f0 [nvmet]
 nvme_loop_execute_work+0x20/0x30 [nvme_loop]
 process_one_work+0x56e/0xa70
 worker_thread+0x2d1/0x640
 kthread+0x183/0x1c0
 ret_from_fork+0x1f/0x30

Cc: stable@vger.kernel.org
Fixes: a07b4970f464 ("nvmet: add a generic NVMe target")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/target/core.c