Skip to contentSkip to conversation

FAILED: patch "[PATCH] xfs: fix buffer overruns in xfs_ioc_attr_list" failed to apply to 6.6-stable tree

PATCH New [email protected] 2 participants 2 messages Nov 4 – Nov 5

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 6.6-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-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x 0b9081a774ee7b9dff1e9ac3765b73c1d6bba5b2
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026110440-penalize-refocus-9272@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..'

Possible dependencies:

thanks,

greg k-h

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

From 0b9081a774ee7b9dff1e9ac3765b73c1d6bba5b2 Mon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <[email protected]>
Date: Tue, 22 Sep 2026 22:58:08 -0700
Subject: [PATCH] xfs: fix buffer overruns in xfs_ioc_attr_list

When we converted the al_offset array in struct xfs_attrlist into a VLA, the size of the object shrank by 4 bytes. Unfortunately, the buffer size validation in the attrlist ioctl wasn't updated to notice this, so the al_offset[0] assignment blindly writes off the end of the buffer. LOLLM noticed the omitted check and complained.

Fixes 371baf5c9750a2 ("xfs: convert flex-array declarations in struct xfs_attrlist*")
Assisted-by LOLLM # finding obvious bugs
fs/xfs/xfs_handle.c +1 -1
index 0689cade8f74..fd9d4d8258ff 100644
@@ -409,7 +409,7 @@ xfs_ioc_attr_list(
 	void				*buffer;
 	int				error;
 
-	if (bufsize < sizeof(struct xfs_attrlist) ||
+	if (bufsize < struct_size(alist, al_offset, 1) ||
 	    bufsize > XFS_XATTR_LIST_MAX)
 		return -EINVAL;
 
maintainer
#1 lore raw

PATCH 1/1 xfs: fix buffer overruns in xfs_ioc_attr_list

From: "Darrick J. Wong" <[email protected]>

[ Upstream commit 0b9081a774ee7b9dff1e9ac3765b73c1d6bba5b2 ]

When we converted the al_offset array in struct xfs_attrlist into a VLA, the size of the object shrank by 4 bytes. Unfortunately, the buffer size validation in the attrlist ioctl wasn't updated to notice this, so the al_offset[0] assignment blindly writes off the end of the buffer. LOLLM noticed the omitted check and complained.

Fixes 371baf5c9750a2 ("xfs: convert flex-array declarations in struct xfs_attrlist*")
Assisted-by LOLLM # finding obvious bugs
[ sashal: Applied the unchanged fix at the existing xfs_ioc_attr_list() location because the upstream file split is absent. ]
---
 fs/xfs/xfs_ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_ioctl.c +1 -1
index 1d0c529255667..8f57f478a9b24 100644
@@ -383,7 +383,7 @@ xfs_ioc_attr_list(
 	void				*buffer;
 	int				error;
 
-	if (bufsize < sizeof(struct xfs_attrlist) ||
+	if (bufsize < struct_size(alist, al_offset, 1) ||
 	    bufsize > XFS_XATTR_LIST_MAX)
 		return -EINVAL;
 
Signature · 1 line
2.53.0