]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
xfs: avoid UAF on sc->tempip in xrep_tempfile_create
authorDarrick J. Wong <djwong@kernel.org>
Mon, 27 Jul 2026 05:24:17 +0000 (22:24 -0700)
committerCarlos Maiolino <cem@kernel.org>
Mon, 3 Aug 2026 08:17:34 +0000 (10:17 +0200)
LOLLM noticed a potential UAF if the tempfile creation code fails after
it set sc->tempip.  Fix that.

Cc: stable@vger.kernel.org # v6.10
Fixes: 84c14ee39dd388 ("xfs: create temporary files and directories for online repair")
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>
fs/xfs/scrub/tempfile.c

index e0c630f888cf6e9d2bf005095b17b7a207b13970..98820003b9298fa8af3e1b0328702c436626f8d8 100644 (file)
@@ -174,6 +174,7 @@ out_release_inode:
                xfs_iunlock(sc->tempip, XFS_ILOCK_EXCL);
                xfs_finish_inode_setup(sc->tempip);
                xchk_irele(sc, sc->tempip);
+               sc->tempip = NULL;
        }
 out_release_dquots:
        xfs_qm_dqrele(udqp);