summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVasily Averin2018-11-07 17:01:33 +0100
committerTheodore Ts'o2018-11-07 17:01:33 +0100
commitecaaf408478b6fb4d9986f9b6652f3824e374f4c (patch)
tree29777288d76895dd54f7e11ab4ab220c0f4ecda3
parentext4: fix possible leak of s_journal_flag_rwsem in error path (diff)
downloadkernel-qcow2-linux-ecaaf408478b6fb4d9986f9b6652f3824e374f4c.tar.gz
kernel-qcow2-linux-ecaaf408478b6fb4d9986f9b6652f3824e374f4c.tar.xz
kernel-qcow2-linux-ecaaf408478b6fb4d9986f9b6652f3824e374f4c.zip
ext4: fix buffer leak in ext4_xattr_get_block() on error path
Fixes: dec214d00e0d ("ext4: xattr inode deduplication") Signed-off-by: Vasily Averin <vvs@virtuozzo.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Cc: stable@kernel.org # 4.13
-rw-r--r--fs/ext4/xattr.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index dc1aeab06dba..07c3a115f7ae 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -2272,8 +2272,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;
}