diff options
| author | Darrick J. Wong <djwong@kernel.org> | 2026-09-09 23:00:47 -0700 |
|---|---|---|
| committer | Carlos Maiolino <cem@kernel.org> | 2026-09-15 10:09:57 +0200 |
| commit | 1c32cdc986467eaffeedb6c5334852809555b82d (patch) | |
| tree | 04862b7410b451884417516aa29e7ed53a52e496 | |
| parent | bb991b7f79dd34cc5f24db0f736bf75630c970e7 (diff) | |
| download | linux-next-1c32cdc986467eaffeedb6c5334852809555b82d.tar.gz linux-next-1c32cdc986467eaffeedb6c5334852809555b82d.zip | |
xfs: release orphanage dir inode if chown fails
LOLLM points out that we leak the igrab'd reference to the orphanage
directory inode if chowning it fails. Fix that.
Cc: stable@vger.kernel.org # v6.10
Fixes: 1e58a8ccf2597c ("xfs: move orphan files to the orphanage")
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>
| -rw-r--r-- | fs/xfs/scrub/orphanage.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/xfs/scrub/orphanage.c b/fs/xfs/scrub/orphanage.c index 3aca66869b80..21e31eeaa042 100644 --- a/fs/xfs/scrub/orphanage.c +++ b/fs/xfs/scrub/orphanage.c @@ -192,12 +192,16 @@ xrep_orphanage_create( /* Make sure the orphanage is owned by root. */ error = xrep_chown_orphanage(sc, XFS_I(orphanage_inode)); if (error) - goto out_dput_orphanage; + goto out_rele_orphanage; /* Stash the reference for later and bail out. */ sc->orphanage = XFS_I(orphanage_inode); sc->orphanage_ilock_flags = 0; + orphanage_inode = NULL; +out_rele_orphanage: + if (orphanage_inode) + xchk_irele(sc, XFS_I(orphanage_inode)); out_dput_orphanage: end_creating(orphanage_dentry); out_dput_root: |
