summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorVasily Averin <vvs@virtuozzo.com>2018-11-06 17:01:36 -0500
committerBen Hutchings <ben@decadent.org.uk>2019-02-11 17:53:50 +0000
commitcfda768adeddc179866cf65c4eecb1f1532e67ca (patch)
treeb070e35c9ff7394a94d79112d854031257a48bdf /fs
parentc9b326c5243cc5eceb74356136158e3d24799856 (diff)
downloadlinux-stable-cfda768adeddc179866cf65c4eecb1f1532e67ca.tar.gz
linux-stable-cfda768adeddc179866cf65c4eecb1f1532e67ca.tar.bz2
linux-stable-cfda768adeddc179866cf65c4eecb1f1532e67ca.zip
ext4: avoid buffer leak in ext4_orphan_add() after prior errors
commit feaf264ce7f8d54582e2f66eb82dd9dd124c94f3 upstream. 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> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'fs')
-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 deebe58586c2..5a006b7ac88c 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2629,7 +2629,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));