Skip to content

Commit 70779b8

Browse files
SinkFinderkdave
authored andcommitted
fs/affs: release old buffer head on error path
The reference count of the old buffer head should be decremented on path that fails to get the new buffer head. Fixes: 6b46576 ("fs/affs: add rename exchange") CC: stable@vger.kernel.org # 4.14+ Signed-off-by: Pan Bian <bianpan2016@163.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 92bf226 commit 70779b8

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎fs/affs/namei.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,10 @@ affs_xrename(struct inode *old_dir, struct dentry *old_dentry,
460460
return -EIO;
461461

462462
bh_new = affs_bread(sb, d_inode(new_dentry)->i_ino);
463-
if (!bh_new)
463+
if (!bh_new) {
464+
affs_brelse(bh_old);
464465
return -EIO;
466+
}
465467

466468
/* Remove old header from its parent directory. */
467469
affs_lock_dir(old_dir);

0 commit comments

Comments
 (0)