Message ID | e20676cb8b120f12892f1e6ed80d91ec551ed533.1688403622.git.fdmanana@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs: fix error paths of btrfs_orphan_cleanup() | expand |
On Mon, Jul 03, 2023 at 06:15:30PM +0100, fdmanana@kernel.org wrote: > From: Filipe Manana <fdmanana@suse.com> > > At btrfs_orphan_cleanup(), if we were able to find the inode, we do an > iput() on the inode, then if btrfs_drop_verity_items() succeeds and then > either btrfs_start_transaction() or btrfs_del_orphan_item() fail, we do > another iput() in the respective error paths, resulting in an extra iput() > on the inode. > > Fix this by setting inode to NULL after the first iput(), as iput() > ignores a NULL inode pointer argument. > > Fixes: a13bb2c03848 ("btrfs: add missing iputs on orphan cleanup failure") > Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Boris Burkov <boris@bur.io> > --- > fs/btrfs/inode.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c > index dbbb67293e34..d919318d2498 100644 > --- a/fs/btrfs/inode.c > +++ b/fs/btrfs/inode.c > @@ -3728,6 +3728,7 @@ int btrfs_orphan_cleanup(struct btrfs_root *root) > if (!ret) { > ret = btrfs_drop_verity_items(BTRFS_I(inode)); > iput(inode); > + inode = NULL; > if (ret) > goto out; > } > -- > 2.34.1 >
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index dbbb67293e34..d919318d2498 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -3728,6 +3728,7 @@ int btrfs_orphan_cleanup(struct btrfs_root *root) if (!ret) { ret = btrfs_drop_verity_items(BTRFS_I(inode)); iput(inode); + inode = NULL; if (ret) goto out; }