Skip to content

Commit 5990fd7

Browse files
Darrick J. Wongcmaiolino
authored andcommitted
xfs: fix a UAF problem in xattr repair
The xchk_setup_xattr_buf function can allocate a new value buffer, which means that any reference to ab->value before the call could become a dangling pointer. Fix this by moving an assignment to after the buffer setup. Cc: stable@vger.kernel.org # v6.10 Fixes: e47dcf1 ("xfs: repair extended attributes") Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Carlos Maiolino <cem@kernel.org>
1 parent 2145f44 commit 5990fd7

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/xfs/scrub/attr_repair.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@ xrep_xattr_salvage_remote_attr(
333333
.attr_filter = ent->flags & XFS_ATTR_NSP_ONDISK_MASK,
334334
.namelen = rentry->namelen,
335335
.name = rentry->name,
336-
.value = ab->value,
337336
.valuelen = be32_to_cpu(rentry->valuelen),
338337
};
339338
unsigned int namesize;
@@ -363,6 +362,7 @@ xrep_xattr_salvage_remote_attr(
363362
error = -EDEADLOCK;
364363
if (error)
365364
return error;
365+
args.value = ab->value;
366366

367367
/* Look up the remote value and stash it for reconstruction. */
368368
error = xfs_attr3_leaf_getvalue(leaf_bp, &args);

0 commit comments

Comments
 (0)