* [PATCH] nvme-tcp: fix crash triggered with a dataless request submission
@ 2021-02-10 22:04 Sagi Grimberg
2021-02-10 22:16 ` Chaitanya Kulkarni
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Sagi Grimberg @ 2021-02-10 22:04 UTC (permalink / raw)
To: linux-nvme, Christoph Hellwig, Keith Busch
write-zeros has a bio, but does not have any data buffers associated
with it. Hence should not initialize the request iter for it (which
attempts to reference the bi_io_vec (and crash).
--
run blktests nvme/012 at 2021-02-05 21:53:34
BUG: kernel NULL pointer dereference, address: 0000000000000008
#PF: supervisor read access in kernel mode
#PF: error_code(0x0000) - not-present page
PGD 0 P4D 0
Oops: 0000 [#1] SMP NOPTI
CPU: 15 PID: 12069 Comm: kworker/15:2H Tainted: G S I 5.11.0-rc6+ #1
Hardware name: Dell Inc. PowerEdge R640/06NR82, BIOS 2.10.0 11/12/2020
Workqueue: kblockd blk_mq_run_work_fn
RIP: 0010:nvme_tcp_init_iter+0x7d/0xd0 [nvme_tcp]
RSP: 0018:ffffbd084447bd18 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffffa0bba9f3ce80 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000002000000
RBP: ffffa0ba8ac6fec0 R08: 0000000002000000 R09: 0000000000000000
R10: 0000000002800809 R11: 0000000000000000 R12: 0000000000000000
R13: ffffa0bba9f3cf90 R14: 0000000000000000 R15: 0000000000000000
FS: 0000000000000000(0000) GS:ffffa0c9ff9c0000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000008 CR3: 00000001c9c6c005 CR4: 00000000007706e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
PKRU: 55555554
Call Trace:
nvme_tcp_queue_rq+0xef/0x330 [nvme_tcp]
blk_mq_dispatch_rq_list+0x11c/0x7c0
? blk_mq_flush_busy_ctxs+0xf6/0x110
__blk_mq_sched_dispatch_requests+0x12b/0x170
blk_mq_sched_dispatch_requests+0x30/0x60
__blk_mq_run_hw_queue+0x2b/0x60
process_one_work+0x1cb/0x360
? process_one_work+0x360/0x360
worker_thread+0x30/0x370
? process_one_work+0x360/0x360
kthread+0x116/0x130
? kthread_park+0x80/0x80
ret_from_fork+0x1f/0x30
--
Fixes: cb9b870fba3e ("nvme-tcp: fix wrong setting of request iov_iter")
Reported-by: Yi Zhang <yi.zhang@redhat.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
---
drivers/nvme/host/tcp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index 619b0d8f6e38..69f59d2c5799 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -2271,7 +2271,7 @@ static blk_status_t nvme_tcp_setup_cmd_pdu(struct nvme_ns *ns,
req->data_len = blk_rq_nr_phys_segments(rq) ?
blk_rq_payload_bytes(rq) : 0;
req->curr_bio = rq->bio;
- if (req->curr_bio)
+ if (req->curr_bio && req->data_len)
nvme_tcp_init_iter(req, rq_data_dir(rq));
if (rq_data_dir(rq) == WRITE &&
--
2.27.0
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] nvme-tcp: fix crash triggered with a dataless request submission
2021-02-10 22:04 [PATCH] nvme-tcp: fix crash triggered with a dataless request submission Sagi Grimberg
@ 2021-02-10 22:16 ` Chaitanya Kulkarni
2021-02-11 4:04 ` Yi Zhang
2021-02-11 4:25 ` Keith Busch
2021-02-11 7:06 ` Christoph Hellwig
2 siblings, 1 reply; 5+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-10 22:16 UTC (permalink / raw)
To: Sagi Grimberg, linux-nvme@lists.infradead.org, Christoph Hellwig,
Keith Busch
On 2/10/21 2:10 PM, Sagi Grimberg wrote:
> write-zeros has a bio, but does not have any data buffers associated
> with it. Hence should not initialize the request iter for it (which
> attempts to reference the bi_io_vec (and crash).
> --
> run blktests nvme/012 at 2021-02-05 21:53:34
> BUG: kernel NULL pointer dereference, address: 0000000000000008
> #PF: supervisor read access in kernel mode
> #PF: error_code(0x0000) - not-present page
> PGD 0 P4D 0
> Oops: 0000 [#1] SMP NOPTI
> CPU: 15 PID: 12069 Comm: kworker/15:2H Tainted: G S I 5.11.0-rc6+ #1
> Hardware name: Dell Inc. PowerEdge R640/06NR82, BIOS 2.10.0 11/12/2020
> Workqueue: kblockd blk_mq_run_work_fn
> RIP: 0010:nvme_tcp_init_iter+0x7d/0xd0 [nvme_tcp]
> RSP: 0018:ffffbd084447bd18 EFLAGS: 00010246
> RAX: 0000000000000000 RBX: ffffa0bba9f3ce80 RCX: 0000000000000000
> RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000002000000
> RBP: ffffa0ba8ac6fec0 R08: 0000000002000000 R09: 0000000000000000
> R10: 0000000002800809 R11: 0000000000000000 R12: 0000000000000000
> R13: ffffa0bba9f3cf90 R14: 0000000000000000 R15: 0000000000000000
> FS: 0000000000000000(0000) GS:ffffa0c9ff9c0000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 0000000000000008 CR3: 00000001c9c6c005 CR4: 00000000007706e0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> PKRU: 55555554
> Call Trace:
> nvme_tcp_queue_rq+0xef/0x330 [nvme_tcp]
> blk_mq_dispatch_rq_list+0x11c/0x7c0
> ? blk_mq_flush_busy_ctxs+0xf6/0x110
> __blk_mq_sched_dispatch_requests+0x12b/0x170
> blk_mq_sched_dispatch_requests+0x30/0x60
> __blk_mq_run_hw_queue+0x2b/0x60
> process_one_work+0x1cb/0x360
> ? process_one_work+0x360/0x360
> worker_thread+0x30/0x370
> ? process_one_work+0x360/0x360
> kthread+0x116/0x130
> ? kthread_park+0x80/0x80
> ret_from_fork+0x1f/0x30
> --
>
> Fixes: cb9b870fba3e ("nvme-tcp: fix wrong setting of request iov_iter")
> Reported-by: Yi Zhang <yi.zhang@redhat.com>
> Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Looks good.
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] nvme-tcp: fix crash triggered with a dataless request submission
2021-02-10 22:16 ` Chaitanya Kulkarni
@ 2021-02-11 4:04 ` Yi Zhang
0 siblings, 0 replies; 5+ messages in thread
From: Yi Zhang @ 2021-02-11 4:04 UTC (permalink / raw)
To: Chaitanya Kulkarni, Sagi Grimberg, linux-nvme@lists.infradead.org,
Christoph Hellwig, Keith Busch
On 2/11/21 6:16 AM, Chaitanya Kulkarni wrote:
> On 2/10/21 2:10 PM, Sagi Grimberg wrote:
>> write-zeros has a bio, but does not have any data buffers associated
>> with it. Hence should not initialize the request iter for it (which
>> attempts to reference the bi_io_vec (and crash).
>> --
>> run blktests nvme/012 at 2021-02-05 21:53:34
>> BUG: kernel NULL pointer dereference, address: 0000000000000008
>> #PF: supervisor read access in kernel mode
>> #PF: error_code(0x0000) - not-present page
>> PGD 0 P4D 0
>> Oops: 0000 [#1] SMP NOPTI
>> CPU: 15 PID: 12069 Comm: kworker/15:2H Tainted: G S I 5.11.0-rc6+ #1
>> Hardware name: Dell Inc. PowerEdge R640/06NR82, BIOS 2.10.0 11/12/2020
>> Workqueue: kblockd blk_mq_run_work_fn
>> RIP: 0010:nvme_tcp_init_iter+0x7d/0xd0 [nvme_tcp]
>> RSP: 0018:ffffbd084447bd18 EFLAGS: 00010246
>> RAX: 0000000000000000 RBX: ffffa0bba9f3ce80 RCX: 0000000000000000
>> RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000002000000
>> RBP: ffffa0ba8ac6fec0 R08: 0000000002000000 R09: 0000000000000000
>> R10: 0000000002800809 R11: 0000000000000000 R12: 0000000000000000
>> R13: ffffa0bba9f3cf90 R14: 0000000000000000 R15: 0000000000000000
>> FS: 0000000000000000(0000) GS:ffffa0c9ff9c0000(0000) knlGS:0000000000000000
>> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
>> CR2: 0000000000000008 CR3: 00000001c9c6c005 CR4: 00000000007706e0
>> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
>> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
>> PKRU: 55555554
>> Call Trace:
>> nvme_tcp_queue_rq+0xef/0x330 [nvme_tcp]
>> blk_mq_dispatch_rq_list+0x11c/0x7c0
>> ? blk_mq_flush_busy_ctxs+0xf6/0x110
>> __blk_mq_sched_dispatch_requests+0x12b/0x170
>> blk_mq_sched_dispatch_requests+0x30/0x60
>> __blk_mq_run_hw_queue+0x2b/0x60
>> process_one_work+0x1cb/0x360
>> ? process_one_work+0x360/0x360
>> worker_thread+0x30/0x370
>> ? process_one_work+0x360/0x360
>> kthread+0x116/0x130
>> ? kthread_park+0x80/0x80
>> ret_from_fork+0x1f/0x30
>> --
>>
>> Fixes: cb9b870fba3e ("nvme-tcp: fix wrong setting of request iov_iter")
>> Reported-by: Yi Zhang <yi.zhang@redhat.com>
>> Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
> Looks good.
>
> Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Verified with latest linux-block/for-next.
Tested-by: Yi Zhang <yi.zhang@redhat.com>
> _______________________________________________
> Linux-nvme mailing list
> Linux-nvme@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-nvme
>
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] nvme-tcp: fix crash triggered with a dataless request submission
2021-02-10 22:04 [PATCH] nvme-tcp: fix crash triggered with a dataless request submission Sagi Grimberg
2021-02-10 22:16 ` Chaitanya Kulkarni
@ 2021-02-11 4:25 ` Keith Busch
2021-02-11 7:06 ` Christoph Hellwig
2 siblings, 0 replies; 5+ messages in thread
From: Keith Busch @ 2021-02-11 4:25 UTC (permalink / raw)
To: Sagi Grimberg; +Cc: Christoph Hellwig, linux-nvme
Looks good.
Reviewed-by: Keith Busch <kbusch@kernel.org>
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] nvme-tcp: fix crash triggered with a dataless request submission
2021-02-10 22:04 [PATCH] nvme-tcp: fix crash triggered with a dataless request submission Sagi Grimberg
2021-02-10 22:16 ` Chaitanya Kulkarni
2021-02-11 4:25 ` Keith Busch
@ 2021-02-11 7:06 ` Christoph Hellwig
2 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2021-02-11 7:06 UTC (permalink / raw)
To: Sagi Grimberg; +Cc: Keith Busch, Christoph Hellwig, linux-nvme
Applied to nvme-5.12.
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-02-11 7:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-10 22:04 [PATCH] nvme-tcp: fix crash triggered with a dataless request submission Sagi Grimberg
2021-02-10 22:16 ` Chaitanya Kulkarni
2021-02-11 4:04 ` Yi Zhang
2021-02-11 4:25 ` Keith Busch
2021-02-11 7:06 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox