From: Guoqing Jiang <guoqing.jiang@linux.dev>
To: Alon Zahavi <zahavi.alon@gmail.com>
Cc: linux-nvme@lists.infradead.org, Sagi Grimberg <sagi@grimberg.me>,
Christoph Hellwig <hch@lst.de>,
Chaitanya Kulkarni <chaitanyak@nvidia.com>
Subject: Re: [Bug Report] NVMe-oF/TCP - NULL Pointer Dereference in `nvmet_tcp_execute_request`
Date: Mon, 20 Nov 2023 14:03:28 +0800 [thread overview]
Message-ID: <92d069e7-6400-85b9-6e82-d32da7b258bb@linux.dev> (raw)
In-Reply-To: <CAK5usQsLOcKA55+hZJof2TCc4cZ3+FGqKa1ze9GyPVwDYCVjVg@mail.gmail.com>
On 11/20/23 06:18, Alon Zahavi wrote:
> On Thu, 16 Nov 2023 at 05:28, Guoqing Jiang <guoqing.jiang@linux.dev> wrote:
>>
>> Could you try the change to see if it helps?
>>
>> --- a/drivers/nvme/target/tcp.c
>> +++ b/drivers/nvme/target/tcp.c
>> @@ -1062,7 +1062,7 @@ static int nvmet_tcp_done_recv_pdu(struct
>> nvmet_tcp_queue *queue)
>> le32_to_cpu(req->cmd->common.dptr.sgl.length));
>>
>> nvmet_tcp_handle_req_failure(queue, queue->cmd, req);
>> - return 0;
>> + return -EAGAIN;
>> }
>>
>> Thanks,
>> Guoqing
> Checked it.
> Although it seems useful to return some error here anyways, it doesn't
> help with the bug.
> The flow leading to the NULL deref doesn't reach this code at all,
> which is probably
> part of why it happens.
> The call trace looks like this:
> ```
> nvmet_tcp_execute_request drivers/nvme/target/tcp.c:578 [inline]
> nvmet_tcp_try_recv_data drivers/nvme/target/tcp.c:1232 [inline]
> nvmet_tcp_try_recv_one drivers/nvme/target/tcp.c:1312 [inline]
> nvmet_tcp_try_recv drivers/nvme/target/tcp.c:1338 [inline]
> nvmet_tcp_io_work+0x202a/0x2990 drivers/nvme/target/tcp.c:1388
> ```
> so `nvmet_tcp_done_recv_pdu` is not called here.
My guess is if rcv_state == NVMET_TCP_RECV_PDU, so
nvmet_tcp_try_recv_one -> nvmet_tcp_try_recv_pdu
-> return
nvmet_tcp_done_recv_pdu
->
nvmet_tcp_handle_req_failure
-> *rcv_state =
NVMET_TCP_RECV_DATA*
-> return 0
then back to nvmet_tcp_try_recv_one, it continues to call
nvmet_tcp_try_recv_data instead of goto done_recv.
Thanks,
Guoqing
next prev parent reply other threads:[~2023-11-20 6:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-06 13:39 [Bug Report] NVMe-oF/TCP - NULL Pointer Dereference in `nvmet_tcp_execute_request` Alon Zahavi
2023-11-15 9:40 ` Alon Zahavi
2023-11-16 3:28 ` Guoqing Jiang
2023-11-19 22:18 ` Alon Zahavi
2023-11-20 6:03 ` Guoqing Jiang [this message]
2023-11-20 10:36 ` Sagi Grimberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=92d069e7-6400-85b9-6e82-d32da7b258bb@linux.dev \
--to=guoqing.jiang@linux.dev \
--cc=chaitanyak@nvidia.com \
--cc=hch@lst.de \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
--cc=zahavi.alon@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox