Skip to contentSkip to conversation

FAILED: patch "[PATCH] smb: client: harden POSIX SID length parsing" failed to apply to 5.10-stable tree

PATCH New [email protected] 2 participants 2 messages Jul 14 – Jul 16

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x 7ad2bcf2441430bb2e918fb3ef9a90d775a6e422
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026071425-undertone-protozoan-2d33@gregkh' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'

Possible dependencies:

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 7ad2bcf2441430bb2e918fb3ef9a90d775a6e422 Mon Sep 17 00:00:00 2001
From: Zihan Xi <[email protected]>
Date: Sun, 28 Jun 2026 17:19:24 +0800
Subject: [PATCH] smb: client: harden POSIX SID length parsing

posix_info_sid_size() reads sid[1] to obtain the subauthority count, but its existing boundary check still accepts buffers with only one remaining byte. Require two bytes before reading sid[1] so all client paths that reuse the helper reject truncated POSIX SIDs safely.

Fixes 349e13ad30b4 ("cifs: add smb2 POSIX info level")
Assisted-by Codex:gpt-5.4
fs/smb/client/smb2pdu.c +1 -1
index d058584b8f05..77738900e75e 100644
@@ -5405,7 +5405,7 @@ int posix_info_sid_size(const void *beg, const void *end)
 	size_t subauth;
 	int total;
 
-	if (beg + 1 > end)
+	if (beg + 2 > end)
 		return -1;
 
 	subauth = *(u8 *)(beg+1);
maintainer
#1 lore raw

PATCH 1/1 smb: client: harden POSIX SID length parsing

From: Zihan Xi <[email protected]>

[ Upstream commit 7ad2bcf2441430bb2e918fb3ef9a90d775a6e422 ]

posix_info_sid_size() reads sid[1] to obtain the subauthority count, but its existing boundary check still accepts buffers with only one remaining byte. Require two bytes before reading sid[1] so all client paths that reuse the helper reject truncated POSIX SIDs safely.

Fixes 349e13ad30b4 ("cifs: add smb2 POSIX info level")
Assisted-by Codex:gpt-5.4
---
 fs/cifs/smb2pdu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/smb2pdu.c +1 -1
index 4197096e7fdbcc..5c071089c7424f 100644
@@ -4520,7 +4520,7 @@ int posix_info_sid_size(const void *beg, const void *end)
 	size_t subauth;
 	int total;
 
-	if (beg + 1 > end)
+	if (beg + 2 > end)
 		return -1;
 
 	subauth = *(u8 *)(beg+1);
Signature · 1 line
2.53.0