Skip to content

Commit 6e4ea8e

Browse files
Dave Jonestytso
authored andcommitted
ext4: fix memory leak in xattr
If we take the 2nd retry path in ext4_expand_extra_isize_ea, we potentionally return from the function without having freed these allocations. If we don't do the return, we over-write the previous allocation pointers, so we leak either way. Spotted with Coverity. [ Fixed by tytso to set is and bs to NULL after freeing these pointers, in case in the retry loop we later end up triggering an error causing a jump to cleanup, at which point we could have a double free bug. -- Ted ] Signed-off-by: Dave Jones <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]> Reviewed-by: Eric Sandeen <[email protected]> Cc: [email protected]
1 parent 9c12a83 commit 6e4ea8e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/ext4/xattr.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,6 +1350,8 @@ int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
13501350
s_min_extra_isize) {
13511351
tried_min_extra_isize++;
13521352
new_extra_isize = s_min_extra_isize;
1353+
kfree(is); is = NULL;
1354+
kfree(bs); bs = NULL;
13531355
goto retry;
13541356
}
13551357
error = -1;

0 commit comments

Comments
 (0)