Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Shivam Kumar <kumar.shivam43666@gmail.com>
Cc: Greg KH <greg@kroah.com>,
	security@kernel.org, hch@lst.de, sagi@grimberg.me,
	kch@nvidia.com, linux-nvme@lists.infradead.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] nvmet-tcp: fix out-of-bounds write when receiving an over-long PDU
Date: Mon, 24 Aug 2026 18:59:14 -0600	[thread overview]
Message-ID: <aozo4lBg1fhoojdP@kbusch-mbp> (raw)
In-Reply-To: <20260814194811.1581041-1-kumar.shivam43666@gmail.com>

On Fri, Aug 14, 2026 at 03:48:11PM -0400, Shivam Kumar wrote:
> nvmet_tcp_try_recv_pdu() reads a PDU header into the fixed 128-byte
> queue->pdu union, then computes the remaining payload length as
> 
> 	queue->left = hdr->hlen - queue->offset + hdgst;
> 
> and reads that many more bytes into &queue->pdu + queue->offset, without
> ever bounding the result against sizeof(queue->pdu).
> 
> A struct nvme_tcp_icreq_pdu is itself 128 bytes, exactly the size of the
> union. Once a header digest has been negotiated (hdgst = 4), a second
> ICReq passes the hlen == nvmet_tcp_pdu_size() check but yields
> queue->left = 128 - 8 + 4 = 124, so bytes 8..132 are written into the
> 128-byte buffer -- 4 bytes past its end, over queue->hdr_digest and
> queue->data_digest. Those bytes are attacker-controlled (an ICReq
> carries no digest), and the duplicate ICReq is only rejected later,
> after the overflow. A remote unauthenticated host can thus corrupt
> kernel memory adjacent to the receive buffer.
> 
> Reject any PDU whose declared length would read past the end of
> queue->pdu before the second recv.

Thanks, applied to nvme-7.3.


      parent reply	other threads:[~2026-08-25  0:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2026081459-handoff-wildly-eeb5@gregkh>
2026-08-14 19:48 ` [PATCH] nvmet-tcp: fix out-of-bounds write when receiving an over-long PDU Shivam Kumar
2026-08-19 16:58   ` Shivam Kumar
2026-08-22 22:48   ` Sagi Grimberg
2026-08-25  0:59   ` Keith Busch [this message]

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=aozo4lBg1fhoojdP@kbusch-mbp \
    --to=kbusch@kernel.org \
    --cc=greg@kroah.com \
    --cc=hch@lst.de \
    --cc=kch@nvidia.com \
    --cc=kumar.shivam43666@gmail.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    --cc=security@kernel.org \
    --cc=stable@vger.kernel.org \
    /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