Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Leech <cleech@redhat.com>
To: Hannes Reinecke <hare@kernel.org>
Cc: Sagi Grimberg <sagi@grimberg.me>, Christoph Hellwig <hch@lst.de>,
	Keith Busch <kbusch@kernel.org>,
	linux-nvme@lists.infradead.org
Subject: Re: [PATCH 2/3] nvme-tcp: sanitize request list handling
Date: Tue, 11 Mar 2025 11:53:41 -0700	[thread overview]
Message-ID: <Z9CGtUqkAR6uWWs-@my-developer-toolbox-latest> (raw)
In-Reply-To: <20250307132802.111513-3-hare@kernel.org>

On Fri, Mar 07, 2025 at 02:28:01PM +0100, Hannes Reinecke wrote:
> Validate the request in nvme_tcp_handle_r2t() to ensure it's not
> part of any list, otherwise a malicious R2T PDU might inject a
> loop in request list processing.
> 
> Signed-off-by: Hannes Reinecke <hare@kernel.org>
> ---
>  drivers/nvme/host/tcp.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 

...

> @@ -759,8 +762,12 @@ static int nvme_tcp_handle_r2t(struct nvme_tcp_queue *queue,
>  
>  	nvme_tcp_setup_h2c_data_pdu(req);
>  
> +	WARN_ON(queue->request == req);
> +	WARN_ON(llist_on_list(&req->lentry));
> +	WARN_ON(!list_empty(&req->entry));
>  	llist_add(&req->lentry, &queue->req_list);

Are we happy with a WARN here, or should this be handled as an error?
The idea of an duplicate R2Ts creating a loop in req_list is
frightening.

- Chris



  reply	other threads:[~2025-03-11 18:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-07 13:27 [PATCH 0/3] nvme-tcp: fixup I/O stall on congested sockets Hannes Reinecke
2025-03-07 13:28 ` [PATCH 1/3] nvme-tcp: avoid inline sending when handling R2T PDUs Hannes Reinecke
2025-03-11 18:40   ` Chris Leech
2025-03-12  8:14     ` Hannes Reinecke
2025-03-07 13:28 ` [PATCH 2/3] nvme-tcp: sanitize request list handling Hannes Reinecke
2025-03-11 18:53   ` Chris Leech [this message]
2025-03-12  8:16     ` Hannes Reinecke
2025-03-12 12:27       ` Maurizio Lombardi
2025-03-07 13:28 ` [PATCH 3/3] nvme-tcp: fix I/O stalls on congested sockets Hannes Reinecke
2025-03-11 18:55   ` Chris Leech
2025-03-10 17:02 ` [PATCH 0/3] nvme-tcp: fixup I/O stall " Keith Busch
  -- strict thread matches above, loose matches on Subject: below --
2025-04-03  6:55 [PATCHv3 " Hannes Reinecke
2025-04-03  6:55 ` [PATCH 2/3] nvme-tcp: sanitize request list handling Hannes Reinecke
2025-04-13 23:00   ` Sagi Grimberg
2025-04-14 12:35     ` Hannes Reinecke
2025-04-14 20:29       ` 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=Z9CGtUqkAR6uWWs-@my-developer-toolbox-latest \
    --to=cleech@redhat.com \
    --cc=hare@kernel.org \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /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