From: Vasily Averin Date: Wed, 7 Nov 2018 16:01:33 +0000 (-0500) Subject: ext4: fix buffer leak in ext4_xattr_get_block() on error path X-Git-Tag: v4.18.20~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef3af4ee5b8150f84ddf7037253510b295f57109;p=thirdparty%2Fkernel%2Fstable.git ext4: fix buffer leak in ext4_xattr_get_block() on error path commit ecaaf408478b6fb4d9986f9b6652f3824e374f4c upstream. Fixes: dec214d00e0d ("ext4: xattr inode deduplication") Signed-off-by: Vasily Averin Signed-off-by: Theodore Ts'o Cc: stable@kernel.org # 4.13 Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index 302725176571b..e66100848bb75 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -2282,8 +2282,10 @@ static struct buffer_head *ext4_xattr_get_block(struct inode *inode) if (!bh) return ERR_PTR(-EIO); error = ext4_xattr_check_block(inode, bh); - if (error) + if (error) { + brelse(bh); return ERR_PTR(error); + } return bh; }