mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chris Leech <cleech@redhat.com>
To: YunJe Shin <yjshin0438@gmail.com>
Cc: hch@lst.de, hare@suse.de, ioerts@kookmin.ac.kr,
	kbusch@kernel.org,  kch@nvidia.com, linux-kernel@vger.kernel.org,
	linux-nvme@lists.infradead.org,  sagi@grimberg.me
Subject: Re: [PATCH v2] nvmet-auth: validate negotiate payload length(BUG: KASAN: slab-out-of-bounds)
Date: Tue, 10 Mar 2026 13:47:11 -0700	[thread overview]
Message-ID: <20260310-video-foyer-58fbf3080e9b@redhat.com> (raw)
In-Reply-To: <20260212013338.1417091-1-ioerts@kookmin.ac.kr>

On Thu, Feb 12, 2026 at 10:33:18AM +0900, YunJe Shin wrote:
> From: Yunje Shin <ioerts@kookmin.ac.kr>
> 
> AUTH_SEND negotiation requires at least one DH-HMAC-CHAP protocol descriptor.
> Validate the payload length before parsing the negotiate payload to avoid
> out-of-bounds reads.
> 
> KASAN splat:
> [ 1224.388857] BUG: KASAN: slab-out-of-bounds in nvmet_execute_auth_send+0x1d24/0x2090
> [ 1224.407035] The buggy address belongs to the cache kmalloc-8 of size 8
> [ 1224.407998] allocated 8-byte region [ffff88800a6537c0, ffff88800a6537c8)
> [ 1224.412412] page dumped because: kasan: bad access detected
> 
> Use struct_size() for minimum length computation and move the negotiate
> restart flow into a helper so the call site stays compact.
> 
> Fixes: db1312dd95488 ("nvmet: implement basic In-Band Authentication")
> Signed-off-by: Yunje Shin <ioerts@kookmin.ac.kr>
> ---
> v2:
> - use struct_size() for negotiate payload minimum length
> - split negotiate handling into nvmet_restart_dhchap_auth() helper
> - use NVME_AUTH_DHCHAP_FAILURE_INCORRECT_PAYLOAD instead of NVMe status
> 
> drivers/nvme/target/fabrics-cmd-auth.c | 48 +++++++++++++++++---------
>  1 file changed, 32 insertions(+), 16 deletions(-)
> ...
> +	size_t min_len = struct_size(neg, auth_protocol, 1);

Maybe this could have been struct_size(neg, auth_protocol, neg->napd)?
But the target code also enforces napd == 1, so it ends up being the same.

Reviewed-by: Chris Leech <cleech@redhat.com>


  parent reply	other threads:[~2026-03-10 20:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-11  5:50 [PATCH] nvmet fabrics-cmd-auth.c : validate negotiate payload length(KASAN: slab-out-of-bounds in nvmet_execute_auth_send+0x1d24/0x2090) YunJe Shin
2026-02-11 16:08 ` Christoph Hellwig
2026-02-12  1:33   ` [PATCH v2] nvmet-auth: validate negotiate payload length(BUG: KASAN: slab-out-of-bounds) YunJe Shin
2026-02-12 11:03     ` Hannes Reinecke
2026-03-08 15:12       ` yunje shin
2026-03-10 18:14         ` yunje shin
2026-03-10 20:47     ` Chris Leech [this message]
2026-03-13  6:05       ` yunje shin
2026-03-13  6:11       ` yunje shin

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=20260310-video-foyer-58fbf3080e9b@redhat.com \
    --to=cleech@redhat.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=ioerts@kookmin.ac.kr \
    --cc=kbusch@kernel.org \
    --cc=kch@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    --cc=yjshin0438@gmail.com \
    /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

all inboxes | Powered by JetHome®