mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-11 00:08:50 +00:00
Btrfs: free inode struct when btrfs_new_inode fails
btrfs_new_inode doesn't call iput to free the inode when it fails. Signed-off-by: Shen Feng <shen@cn.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
parent
b5555f7711
commit
09771430f3
@ -3481,8 +3481,10 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
|
||||
|
||||
if (dir) {
|
||||
ret = btrfs_set_inode_index(dir, index);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
iput(inode);
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* index_cnt is ignored for everything but a dir,
|
||||
@ -3565,6 +3567,7 @@ fail:
|
||||
if (dir)
|
||||
BTRFS_I(dir)->index_cnt--;
|
||||
btrfs_free_path(path);
|
||||
iput(inode);
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user