add patch fix-buffer-leak-in-ext4_xattr_move_to_block-on-error-path
[ext4-patch-queue.git] / release-bs_bh-before-reusing-in-ext4_xattr_block_find
blob5cc8f5dfc888ea70f5f1660cb81e27dcc723224f
1 ext4: release bs.bh before re-using in ext4_xattr_block_find()
3 From: Vasily Averin <vvs@virtuozzo.com>
5 bs.bh was taken in previous ext4_xattr_block_find() call,
6 it should be released before re-using
8 Fixes: 7e01c8e5420b ("ext3/4: fix uninitialized bs in ...")
9 Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
10 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
11 Cc: stable@kernel.org # 2.6.26
12 ---
13  fs/ext4/xattr.c | 2 ++
14  1 file changed, 2 insertions(+)
16 diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
17 index 07c3a115f7ae..07b9a335c8eb 100644
18 --- a/fs/ext4/xattr.c
19 +++ b/fs/ext4/xattr.c
20 @@ -2395,6 +2395,8 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
21                         error = ext4_xattr_block_set(handle, inode, &i, &bs);
22                 } else if (error == -ENOSPC) {
23                         if (EXT4_I(inode)->i_file_acl && !bs.s.base) {
24 +                               brelse(bs.bh);
25 +                               bs.bh = NULL;
26                                 error = ext4_xattr_block_find(inode, &i, &bs);
27                                 if (error)
28                                         goto cleanup;
29 -- 
30 2.17.1