]> git.hungrycats.org Git - linux/commitdiff
xfs: always zero the whole shortform header when zeroing attr fork
authorDarrick J. Wong <djwong@kernel.org>
Mon, 5 Oct 2026 05:58:09 +0000 (22:58 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Nov 2026 17:06:02 +0000 (12:06 -0500)
commit 52aa50cea408e27454d206cccecbe4f694a6c1e1 upstream.

LOLLM noticed that xrep_xattr_fork_remove can decide to reset the attr
fork contents to an empty shortform header, but then fails to zero the
padding byte in the header.  Fix that.

Cc: stable@vger.kernel.org # v6.10
Fixes: e47dcf113ae348 ("xfs: repair extended attributes")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Assisted-by: LOLLM # finding obvious bugs
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/scrub/attr_repair.c

index 766119325234e4519c636b777587acf9291e8524..ab5bd7a4d4abbaf4f06246697026249132ffecf5 100644 (file)
@@ -970,7 +970,7 @@ xrep_xattr_fork_remove(
                ifp->if_format = XFS_DINODE_FMT_LOCAL;
                hdr = xfs_idata_realloc(ip, (int)sizeof(*hdr) - ifp->if_bytes,
                                XFS_ATTR_FORK);
-               hdr->count = 0;
+               memset(hdr, 0, sizeof(*hdr));
                hdr->totsize = cpu_to_be16(sizeof(*hdr));
                xfs_trans_log_inode(sc->tp, ip,
                                XFS_ILOG_CORE | XFS_ILOG_ADATA);