Skip to content
Commit 609d9937 authored by Filipe Manana's avatar Filipe Manana Committed by David Sterba
Browse files

btrfs: fix qgroup record leaks when using simple quotas



When using simple quotas we are not supposed to allocate qgroup records
when adding delayed references. However we allocate them if either mode
of quotas is enabled (the new simple one or the old one), but then we
never free them because running the accounting, which frees the records,
is only run when using the old quotas (at btrfs_qgroup_account_extents()),
resulting in a memory leak of the records allocated when adding delayed
references.

Fix this by allocating the records only if the old quotas mode is enabled.
Also fix btrfs_qgroup_trace_extent_nolock() to return 1 if the old quotas
mode is not enabled - meaning the caller has to free the record.

Fixes: 182940f4 ("btrfs: qgroup: add new quota mode for simple quotas")
Reported-by: default avatar <syzbot+d3ddc6dcc6386dea398b@syzkaller.appspotmail.com>
Link: https://lore.kernel.org/linux-btrfs/00000000000004769106097f9a34@google.com/


Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 6c8e69e4
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment