All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvmet-auth: reject overlong negotiate identifier lists
@ 2026-08-10 15:56 Jérémy Jean
  2026-08-11 10:26 ` Hannes Reinecke
  2026-08-11 15:47 ` Keith Busch
  0 siblings, 2 replies; 3+ messages in thread
From: Jérémy Jean @ 2026-08-10 15:56 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni, linux-nvme,
	linux-kernel, Jérémy Jean, stable

The DH-HMAC-CHAP NEGOTIATE descriptor carries separate lengths for the
hash and DH identifier lists, but each list occupies a fixed 30-byte half
of idlist[]. nvmet_auth_negotiate() uses halen and dhlen from the wire as
loop bounds without validating them, so a remote initiator can make the
target read past the 72-byte request buffer. KASAN reports a 
slab-out-of-bounds read in nvmet_execute_auth_send().

Reject list lengths above the protocol maxima before either loop
indexes idlist[].

Fixes: db1312dd9548 ("nvmet: implement basic In-Band Authentication")
Cc: stable@vger.kernel.org
Assisted-by: Codex:gpt-5
Signed-off-by: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
---
 drivers/nvme/target/fabrics-cmd-auth.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/nvme/target/fabrics-cmd-auth.c b/drivers/nvme/target/fabrics-cmd-auth.c
index 45820a12750d..8679d5db4f86 100644
--- a/drivers/nvme/target/fabrics-cmd-auth.c
+++ b/drivers/nvme/target/fabrics-cmd-auth.c
@@ -71,6 +71,12 @@ static u8 nvmet_auth_negotiate(struct nvmet_req *req, void *d)
 	    NVME_AUTH_DHCHAP_AUTH_ID)
 		return NVME_AUTH_DHCHAP_FAILURE_INCORRECT_PAYLOAD;
 
+	if (data->auth_protocol[0].dhchap.halen >
+	    NVME_AUTH_DHCHAP_MAX_HASH_IDS ||
+	    data->auth_protocol[0].dhchap.dhlen >
+	    NVME_AUTH_DHCHAP_MAX_DH_IDS)
+		return NVME_AUTH_DHCHAP_FAILURE_INCORRECT_PAYLOAD;
+
 	for (i = 0; i < data->auth_protocol[0].dhchap.halen; i++) {
 		u8 host_hmac_id = data->auth_protocol[0].dhchap.idlist[i];
 
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-11 15:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-10 15:56 [PATCH] nvmet-auth: reject overlong negotiate identifier lists Jérémy Jean
2026-08-11 10:26 ` Hannes Reinecke
2026-08-11 15:47 ` Keith Busch

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.