From: Damien Le Moal <dlemoal@kernel.org>
To: Richard Weinberger <richard@nod.at>, linux-kernel@vger.kernel.org
Cc: linux-nvme@lists.infradead.org, kbusch@kernel.org,
kch@nvidia.com, sagi@grimberg.me, hch@lst.de,
upstream+nvme@sigma-star.at
Subject: Re: [PATCH] nvmet: Fix out-of-bounds access in nvmet_enable_port
Date: Fri, 18 Apr 2025 17:04:39 +0900 [thread overview]
Message-ID: <169955ba-63b3-4d25-b8f2-afcea36d3f95@kernel.org> (raw)
In-Reply-To: <20250418080250.2736590-1-richard@nod.at>
On 4/18/25 17: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>
My bad :) Thanks for the fix !
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2025-04-18 8: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 [this message]
2025-04-18 10:54 ` Sagi Grimberg
2025-04-22 6:33 ` Chaitanya Kulkarni
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=169955ba-63b3-4d25-b8f2-afcea36d3f95@kernel.org \
--to=dlemoal@kernel.org \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=kch@nvidia.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox