add patch fix-buffer-leak-in-ext4_xattr_move_to_block-on-error-path
[ext4-patch-queue.git] / avoid-buffer-leak-in-ext4_orphan_add-after-prior-errors
blobb3e2bd37652c90d21c7f0213a241ee1f858cb2e4
1 ext4: avoid buffer leak in ext4_orphan_add() after prior errors
3 From: Vasily Averin <vvs@virtuozzo.com>
5 Fixes: d745a8c20c1f ("ext4: reduce contention on s_orphan_lock")
6 Fixes: 6e3617e579e0 ("ext4: Handle non empty on-disk orphan link")
7 Cc: Dmitry Monakhov <dmonakhov@gmail.com>
8 Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
9 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 Cc: stable@kernel.org # 2.6.34
11 ---
12  fs/ext4/namei.c | 4 +++-
13  1 file changed, 3 insertions(+), 1 deletion(-)
15 diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
16 index 67a38532032a..d388cce72db2 100644
17 --- a/fs/ext4/namei.c
18 +++ b/fs/ext4/namei.c
19 @@ -2811,7 +2811,9 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode)
20                         list_del_init(&EXT4_I(inode)->i_orphan);
21                         mutex_unlock(&sbi->s_orphan_lock);
22                 }
23 -       }
24 +       } else
25 +               brelse(iloc.bh);
27         jbd_debug(4, "superblock will point to %lu\n", inode->i_ino);
28         jbd_debug(4, "orphan inode %lu will point to %d\n",
29                         inode->i_ino, NEXT_ORPHAN(inode));
30 -- 
31 2.17.1