提交 aeba5c4e 编写于 作者: P Pan Bian 提交者: Zheng Zengkai

fs/affs: release old buffer head on error path

stable inclusion
from stable-5.10.20
commit 885a2d24c219354639306c63b5e658fdc25ebbb5
bugzilla: 50608

--------------------------------

commit 70779b89 upstream.

The reference count of the old buffer head should be decremented on path
that fails to get the new buffer head.

Fixes: 6b465766 ("fs/affs: add rename exchange")
CC: stable@vger.kernel.org # 4.14+
Signed-off-by: NPan Bian <bianpan2016@163.com>
Signed-off-by: NDavid Sterba <dsterba@suse.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 c2a7053a
......@@ -460,8 +460,10 @@ affs_xrename(struct inode *old_dir, struct dentry *old_dentry,
return -EIO;
bh_new = affs_bread(sb, d_inode(new_dentry)->i_ino);
if (!bh_new)
if (!bh_new) {
affs_brelse(bh_old);
return -EIO;
}
/* Remove old header from its parent directory. */
affs_lock_dir(old_dir);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册