All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Keith Busch <kbusch@kernel.org>
Cc: Eugene Korenevsky <ekorenevsky@aliyun.com>,
	Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
	Sagi Grimberg <sagi@grimberg.me>,
	linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] nvme: nvme_identify_ns_descs: prevent oob
Date: Thu, 27 Nov 2025 15:49:16 +0100	[thread overview]
Message-ID: <20251127144916.GA9423@lst.de> (raw)
In-Reply-To: <aSdoeEX_L2-3ccpF@kbusch-mbp>

On Wed, Nov 26, 2025 at 01:52:08PM -0700, Keith Busch wrote:
> On Wed, Nov 26, 2025 at 11:27:21PM +0300, Eugene Korenevsky wrote:
> > Broken or malicious controller can send invalid ns id.
> > Out-of-band memory access may occur if remaining buffer size
> > is less than .nidl (ns id length) field of `struct nvme_ns_id_desc`
> > 
> > Fix this issue by making nvme_process_id_decs() function aware of
> > remaining buffer size.
> > 
> > Also simplify nvme_process_id_decs(): replace copy-pasted `case`
> > branches with table lookup.
> > 
> > Signed-off-by: Eugene Korenevsky <ekorenevsky@aliyun.com>
> > ---
> >  drivers/nvme/host/core.c | 80 ++++++++++++++++++++--------------------
> >  1 file changed, 39 insertions(+), 41 deletions(-)
> 
> Is this simpler check not sufficient?

I think we'll need a somewhat more complex check that at there
is at least enough space for the len member.  But I prefer that
style over a table lookup and magic name pasting macros.



  parent reply	other threads:[~2025-11-27 14:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-26 20:27 [PATCH] nvme: nvme_identify_ns_descs: prevent oob Eugene Korenevsky
2025-11-26 20:52 ` Keith Busch
2025-11-26 21:45   ` Eugene Korenevsky
2025-11-27 14:49   ` Christoph Hellwig [this message]
2025-11-29 19:57     ` Eugene Korenevsky
2025-11-30 22:20       ` 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=20251127144916.GA9423@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=ekorenevsky@aliyun.com \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.