All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chaitanya Kulkarni <chaitanyak@nvidia.com>
To: Richard Weinberger <richard@nod.at>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
	"dlemoal@kernel.org" <dlemoal@kernel.org>,
	"kbusch@kernel.org" <kbusch@kernel.org>,
	Chaitanya Kulkarni <chaitanyak@nvidia.com>,
	"sagi@grimberg.me" <sagi@grimberg.me>, "hch@lst.de" <hch@lst.de>,
	"upstream+nvme@sigma-star.at" <upstream+nvme@sigma-star.at>
Subject: Re: [PATCH] nvmet: Fix out-of-bounds access in nvmet_enable_port
Date: Tue, 22 Apr 2025 06:33:30 +0000	[thread overview]
Message-ID: <3e38cbd2-c785-4720-8f90-71849f548f4c@nvidia.com> (raw)
In-Reply-To: <20250418080250.2736590-1-richard@nod.at>

On 4/18/25 01:02, Richard Weinberger wrote:
> When trying to enable a port that has no transport configured yet,
> nvmet_enable_port() uses NVMF_TRTYPE_MAX (255) to query the transports
> array, causing an out-of-bounds access:
>
> [  106.058694] BUG: KASAN: global-out-of-bounds in nvmet_enable_port+0x42/0x1da
> [  106.058719] Read of size 8 at addr ffffffff89dafa58 by task ln/632
> [...]
> [  106.076026] nvmet: transport type 255 not supported
>
> Since commit 200adac75888, NVMF_TRTYPE_MAX is the default state as configured by
> nvmet_ports_make().
> Avoid this by checking for NVMF_TRTYPE_MAX before proceeding.
>
> Fixes: 200adac75888 ("nvme: Add PCI transport type")
> Signed-off-by: Richard Weinberger<richard@nod.at>

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



  parent reply	other threads:[~2025-04-22  6:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-18  8:02 [PATCH] nvmet: Fix out-of-bounds access in nvmet_enable_port Richard Weinberger
2025-04-18  8:04 ` Damien Le Moal
2025-04-18 10:54 ` Sagi Grimberg
2025-04-22  6:33 ` Chaitanya Kulkarni [this message]
2025-04-22  7:50 ` Christoph Hellwig

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=3e38cbd2-c785-4720-8f90-71849f548f4c@nvidia.com \
    --to=chaitanyak@nvidia.com \
    --cc=dlemoal@kernel.org \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=sagi@grimberg.me \
    --cc=upstream+nvme@sigma-star.at \
    /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.