2018-11-01 04:12:27

by Vasily Averin

[permalink] [raw]
Subject: [PATCH 6/7] ext4: lost brelse in ext4_xattr_move_to_block()

Fixes 3f2571c1f91f ("ext4: factor out xattr moving")
cc: Jan Kara <[email protected]>
however issue was present in original ext4_expand_extra_isize_ea()
Fixes 6dd4ee7cab7e ("ext4: Expand extra_inodes space per ...") # 2.6.23
cc: Kalpak Shah <[email protected]>

Signed-off-by: Vasily Averin <[email protected]>
---
fs/ext4/xattr.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 07b9a335c8eb..5c9bc0d85cc0 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -2617,6 +2617,8 @@ static int ext4_xattr_move_to_block(handle_t *handle, struct inode *inode,
kfree(buffer);
if (is)
brelse(is->iloc.bh);
+ if (bs)
+ brelse(bs->bh);
kfree(is);
kfree(bs);

--
2.17.1


2018-11-07 23:20:46

by Jan Kara

[permalink] [raw]
Subject: Re: [PATCH 6/7] ext4: lost brelse in ext4_xattr_move_to_block()

On Wed 31-10-18 22:13:00, Vasily Averin wrote:
> Fixes 3f2571c1f91f ("ext4: factor out xattr moving")
> cc: Jan Kara <[email protected]>
> however issue was present in original ext4_expand_extra_isize_ea()
> Fixes 6dd4ee7cab7e ("ext4: Expand extra_inodes space per ...") # 2.6.23
> cc: Kalpak Shah <[email protected]>
>
> Signed-off-by: Vasily Averin <[email protected]>

Good catch. Thanks for the fix. The patch looks good. You can add:

Reviewed-by: Jan Kara <[email protected]>

Honza

> ---
> fs/ext4/xattr.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
> index 07b9a335c8eb..5c9bc0d85cc0 100644
> --- a/fs/ext4/xattr.c
> +++ b/fs/ext4/xattr.c
> @@ -2617,6 +2617,8 @@ static int ext4_xattr_move_to_block(handle_t *handle, struct inode *inode,
> kfree(buffer);
> if (is)
> brelse(is->iloc.bh);
> + if (bs)
> + brelse(bs->bh);
> kfree(is);
> kfree(bs);
>
> --
> 2.17.1
>
--
Jan Kara <[email protected]>
SUSE Labs, CR

2018-11-08 01:42:38

by Theodore Ts'o

[permalink] [raw]
Subject: Re: [PATCH 6/7] ext4: lost brelse in ext4_xattr_move_to_block()

On Wed, Nov 07, 2018 at 02:50:16PM +0100, Jan Kara wrote:
> On Wed 31-10-18 22:13:00, Vasily Averin wrote:
> > Fixes 3f2571c1f91f ("ext4: factor out xattr moving")
> > cc: Jan Kara <[email protected]>
> > however issue was present in original ext4_expand_extra_isize_ea()
> > Fixes 6dd4ee7cab7e ("ext4: Expand extra_inodes space per ...") # 2.6.23
> > cc: Kalpak Shah <[email protected]>
> >
> > Signed-off-by: Vasily Averin <[email protected]>
>
> Good catch. Thanks for the fix. The patch looks good. You can add:
>
> Reviewed-by: Jan Kara <[email protected]>

Thanks, applied. I used the commit description:

ext4: fix buffer leak in ext4_xattr_move_to_block() on error path

- Ted