Skip to content

Commit 885a2d2

Browse files
SinkFindergregkh
authored andcommitted
fs/affs: release old buffer head on error path
commit 70779b8 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent df2d431 commit 885a2d2

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)