Commit 183af2d
btrfs: fix memory leaks after failure to lookup checksums during inode logging
commit 4f26433 upstream.
While logging an inode, at copy_items(), if we fail to lookup the checksums
for an extent we release the destination path, free the ins_data array and
then return immediately. However a previous iteration of the for loop may
have added checksums to the ordered_sums list, in which case we leak the
memory used by them.
So fix this by making sure we iterate the ordered_sums list and free all
its checksums before returning.
Fixes: 3650860 ("Btrfs: remove almost all of the BUG()'s from tree-log.c")
CC: stable@vger.kernel.org # 4.4+
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 627fa9d commit 183af2d
1 file changed
Lines changed: 2 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3988 | 3988 | | |
3989 | 3989 | | |
3990 | 3990 | | |
3991 | | - | |
3992 | | - | |
3993 | | - | |
3994 | | - | |
3995 | | - | |
| 3991 | + | |
| 3992 | + | |
3996 | 3993 | | |
3997 | 3994 | | |
3998 | 3995 | | |
| |||
4005 | 4002 | | |
4006 | 4003 | | |
4007 | 4004 | | |
4008 | | - | |
4009 | 4005 | | |
4010 | 4006 | | |
4011 | 4007 | | |
| |||
0 commit comments