Skip to contentSkip to conversation

nvme-tcp: Fix comma-related oops

PATCH Applied David Howells 5 participants 5 messages Jun 29, 2023 – Jul 2, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme-tcp: Fix comma-related oops

Fix a comma that should be a semicolon. The comma is at the end of an if-body and thus makes the statement after (a bvec_set_page()) conditional too, resulting in an oops because we didn't fill out the bio_vec[]:

    BUG: kernel NULL pointer dereference, address: 0000000000000008
    #PF: supervisor read access in kernel mode
    #PF: error_code(0x0000) - not-present page
    ...
    Workqueue: nvme_tcp_wq nvme_tcp_io_work [nvme_tcp]
    RIP: 0010:skb_splice_from_iter+0xf1/0x370
    ...
    Call Trace:
     tcp_sendmsg_locked+0x3a6/0xdd0
     tcp_sendmsg+0x31/0x50
     inet_sendmsg+0x47/0x80
     sock_sendmsg+0x99/0xb0
     nvme_tcp_try_send_data+0x149/0x490 [nvme_tcp]
     nvme_tcp_try_send+0x1b7/0x300 [nvme_tcp]
     nvme_tcp_io_work+0x40/0xc0 [nvme_tcp]
     process_one_work+0x21c/0x430
     worker_thread+0x54/0x3e0
     kthread+0xf8/0x130
Fixes 7769887817c3 ("nvme-tcp: Use sendmsg(MSG_SPLICE_PAGES) rather then sendpage")
cc Sagi Grimberg <[email protected]>
cc Willem de Bruijn <[email protected]>
cc Keith Busch <[email protected]>
cc Jens Axboe <[email protected]>
cc Christoph Hellwig <[email protected]>
cc Chaitanya Kulkarni <[email protected]>
cc "David S. Miller" <[email protected]>
cc Eric Dumazet <[email protected]>
cc Jakub Kicinski <[email protected]>
cc Paolo Abeni <[email protected]>
cc Jens Axboe <[email protected]>
cc Jens Axboe <[email protected]>
cc Matthew Wilcox <[email protected]>
---
 drivers/nvme/host/tcp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/tcp.c +1 -1
index 3e7dd6f91832..9ce417cd32a7 100644
@@ -1014,7 +1014,7 @@ static int nvme_tcp_try_send_data(struct nvme_tcp_request *req)
 			msg.msg_flags |= MSG_MORE;
 
 		if (!sendpage_ok(page))
-			msg.msg_flags &= ~MSG_SPLICE_PAGES,
+			msg.msg_flags &= ~MSG_SPLICE_PAGES;
 
 		bvec_set_page(&bvec, page, len, offset);
 		iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, &bvec, 1, len);
Reviewed-by on v1 1/1
#1 lore raw
Quoted 42 lines · David Howells

Fix a comma that should be a semicolon. The comma is at the end of an if-body and thus makes the statement after (a bvec_set_page()) conditional too, resulting in an oops because we didn't fill out the bio_vec[]:

     BUG: kernel NULL pointer dereference, address: 0000000000000008
     #PF: supervisor read access in kernel mode
     #PF: error_code(0x0000) - not-present page
     ...
     Workqueue: nvme_tcp_wq nvme_tcp_io_work [nvme_tcp]
     RIP: 0010:skb_splice_from_iter+0xf1/0x370
     ...
     Call Trace:
      tcp_sendmsg_locked+0x3a6/0xdd0
      tcp_sendmsg+0x31/0x50
      inet_sendmsg+0x47/0x80
      sock_sendmsg+0x99/0xb0
      nvme_tcp_try_send_data+0x149/0x490 [nvme_tcp]
      nvme_tcp_try_send+0x1b7/0x300 [nvme_tcp]
      nvme_tcp_io_work+0x40/0xc0 [nvme_tcp]
      process_one_work+0x21c/0x430
      worker_thread+0x54/0x3e0
      kthread+0xf8/0x130
Fixes 7769887817c3 ("nvme-tcp: Use sendmsg(MSG_SPLICE_PAGES) rather then sendpage")
cc Sagi Grimberg <[email protected]>
cc Willem de Bruijn <[email protected]>
cc Keith Busch <[email protected]>
cc Jens Axboe <[email protected]>
cc Christoph Hellwig <[email protected]>
cc Chaitanya Kulkarni <[email protected]>
cc "David S. Miller" <[email protected]>
cc Eric Dumazet <[email protected]>
cc Jakub Kicinski <[email protected]>
cc Paolo Abeni <[email protected]>
cc Jens Axboe <[email protected]>
cc Jens Axboe <[email protected]>
cc Matthew Wilcox <[email protected]>
Quoted 2 lines

---

-ck

maintainer
#2 lore raw
In reply to David Howells
Quoted 23 lines · David Howells

Fix a comma that should be a semicolon. The comma is at the end of an if-body and thus makes the statement after (a bvec_set_page()) conditional too, resulting in an oops because we didn't fill out the bio_vec[]:

    BUG: kernel NULL pointer dereference, address: 0000000000000008
    #PF: supervisor read access in kernel mode
    #PF: error_code(0x0000) - not-present page
    ...
    Workqueue: nvme_tcp_wq nvme_tcp_io_work [nvme_tcp]
    RIP: 0010:skb_splice_from_iter+0xf1/0x370
    ...
    Call Trace:
     tcp_sendmsg_locked+0x3a6/0xdd0
     tcp_sendmsg+0x31/0x50
     inet_sendmsg+0x47/0x80
     sock_sendmsg+0x99/0xb0
     nvme_tcp_try_send_data+0x149/0x490 [nvme_tcp]
     nvme_tcp_try_send+0x1b7/0x300 [nvme_tcp]
     nvme_tcp_io_work+0x40/0xc0 [nvme_tcp]
     process_one_work+0x21c/0x430
     worker_thread+0x54/0x3e0
     kthread+0xf8/0x130
Quoted 1 line
Fixes 7769887817c3 ("nvme-tcp: Use sendmsg(MSG_SPLICE_PAGES) rather then sendpage")

We don't have this breaking commit in the nvme tree just yet, so feel free to take the fix through net if this can't wait for the next nvme rebase (we're based on the block tree).

maintainer
#3 lore raw
Quoted 3 lines · On Fri, 30 Jun 2023 09:20:40 -0600 Keith Busch wrote:

We don't have this breaking commit in the nvme tree just yet, so feel free to take the fix through net if this can't wait for the next nvme rebase (we're based on the block tree).

Ack, will do, thanks! We'll most likely send it in a PR later today.

#4 lore raw
In reply to David Howells
This patch was applied to netdev/net.git (main) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <[email protected]>:

Quoted 23 lines · On Thu, 29 Jun 2023 22:47:53 +0100 you wrote:

Fix a comma that should be a semicolon. The comma is at the end of an if-body and thus makes the statement after (a bvec_set_page()) conditional too, resulting in an oops because we didn't fill out the bio_vec[]:

    BUG: kernel NULL pointer dereference, address: 0000000000000008
    #PF: supervisor read access in kernel mode
    #PF: error_code(0x0000) - not-present page
    ...
    Workqueue: nvme_tcp_wq nvme_tcp_io_work [nvme_tcp]
    RIP: 0010:skb_splice_from_iter+0xf1/0x370
    ...
    Call Trace:
     tcp_sendmsg_locked+0x3a6/0xdd0
     tcp_sendmsg+0x31/0x50
     inet_sendmsg+0x47/0x80
     sock_sendmsg+0x99/0xb0
     nvme_tcp_try_send_data+0x149/0x490 [nvme_tcp]
     nvme_tcp_try_send+0x1b7/0x300 [nvme_tcp]
     nvme_tcp_io_work+0x40/0xc0 [nvme_tcp]
     process_one_work+0x21c/0x430
     worker_thread+0x54/0x3e0
     kthread+0xf8/0x130
Quoted 1 line

[...]

Here is the summary with links:
- [net] nvme-tcp: Fix comma-related oops

    https://git.kernel.org/netdev/net/c/c97d3fb9e0e7

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html