From: Vasily Averin Date: Tue, 6 Nov 2018 22:01:36 +0000 (-0500) Subject: ext4: avoid buffer leak in ext4_orphan_add() after prior errors X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cffd3297173a7397da8171cd2ef20ae8eec8cee8;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Vasily Averin Signed-off-by: Theodore Ts'o Cc: stable@kernel.org # 2.6.34 Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index eb0d8ee39827..cfa0dc2d97cd 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -2820,7 +2820,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));