summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVasily Averin <vvs@virtuozzo.com>2018-11-06 23:01:36 +0100
committerTheodore Ts'o <tytso@mit.edu>2018-11-06 23:01:36 +0100
commitfeaf264ce7f8d54582e2f66eb82dd9dd124c94f3 (patch)
treec07a6ae656ff85041fb63f38b4879bceeb7e329a
parentext4: avoid buffer leak on shutdown in ext4_mark_iloc_dirty() (diff)
downloadlinux-feaf264ce7f8d54582e2f66eb82dd9dd124c94f3.tar.xz
linux-feaf264ce7f8d54582e2f66eb82dd9dd124c94f3.zip
ext4: avoid buffer leak in ext4_orphan_add() after prior errors
Fixes: d745a8c20c1f ("ext4: reduce contention on s_orphan_lock") Fixes: 6e3617e579e0 ("ext4: Handle non empty on-disk orphan link") Cc: Dmitry Monakhov <dmonakhov@gmail.com> Signed-off-by: Vasily Averin <vvs@virtuozzo.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Cc: stable@kernel.org # 2.6.34
-rw-r--r--fs/ext4/namei.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 67a38532032a..d388cce72db2 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2811,7 +2811,9 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode)
list_del_init(&EXT4_I(inode)->i_orphan);
mutex_unlock(&sbi->s_orphan_lock);
}
- }
+ } else
+ brelse(iloc.bh);
+
jbd_debug(4, "superblock will point to %lu\n", inode->i_ino);
jbd_debug(4, "orphan inode %lu will point to %d\n",
inode->i_ino, NEXT_ORPHAN(inode));