summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2021-02-21 09:59:09 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2021-02-21 09:59:09 -0800
commitf9d58de23152f2c16f326d7e014cfa2933b00304 (patch)
tree5c0f3f4bf41d0df96744c7fa3ac347c90f3aec68
parentd88e8b67a6f2f6dae41c986ed58cb1955e0179b3 (diff)
parent70779b897395b330ba5a47bed84f94178da599f9 (diff)
Merge tag 'affs-for-5.12-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
Pull AFFS fix from David Sterba: "One minor fix for error handling in rename exchange" * tag 'affs-for-5.12-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux: fs/affs: release old buffer head on error path
-rw-r--r--fs/affs/namei.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/affs/namei.c b/fs/affs/namei.c
index 41c5749f4db7..5400a876d73f 100644
--- a/fs/affs/namei.c
+++ b/fs/affs/namei.c
@@ -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);