]> www.infradead.org Git - users/hch/xfsprogs.git/commit
xfs_scrub: avoid potential UAF after freeing a duplicate name entry
authorDarrick J. Wong <djwong@kernel.org>
Mon, 29 Jul 2024 23:23:10 +0000 (16:23 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 30 Jul 2024 00:01:08 +0000 (17:01 -0700)
commitdcfea337c21acad47ccdc1ad6eb30480d0988e4c
tree2ed0274c070bc00f4570da44955137d1ccc2791e
parent8aadd8e0d89905f2e2411d1b39217a6a3acea596
xfs_scrub: avoid potential UAF after freeing a duplicate name entry

Change the function declaration of unicrash_add to set the caller's
@new_entry to NULL if we detect an updated name entry and do not wish to
continue processing.  This avoids a theoretical UAF if the unicrash_add
caller were to accidentally continue using the pointer.

This isn't an /actual/ UAF because the function formerly set @badflags
to zero, but let's be a little defensive.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
scrub/unicrash.c