Skip to content

Commit c346c62

Browse files
pchelkin91kdave
authored andcommitted
btrfs: qgroup: don't use extent changeset when not needed
The local extent changeset is passed to clear_record_extent_bits() where it may have some additional memory dynamically allocated for ulist. When qgroup is disabled, the memory is leaked because in this case the changeset is not released upon __btrfs_qgroup_release_data() return. Since the recorded contents of the changeset are not used thereafter, just don't pass it. Found by Linux Verification Center (linuxtesting.org) with Syzkaller. Reported-by: syzbot+81670362c283f3dd889c@syzkaller.appspotmail.com Closes: https://lore.kernel.org/lkml/000000000000aa8c0c060ade165e@google.com Fixes: af0e2aa ("btrfs: qgroup: flush reservations during quota disable") CC: stable@vger.kernel.org # 6.10+ Reviewed-by: Boris Burkov <boris@bur.io> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent ecb5427 commit c346c62

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

fs/btrfs/qgroup.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4346,10 +4346,9 @@ static int __btrfs_qgroup_release_data(struct btrfs_inode *inode,
43464346
int ret;
43474347

43484348
if (btrfs_qgroup_mode(inode->root->fs_info) == BTRFS_QGROUP_MODE_DISABLED) {
4349-
extent_changeset_init(&changeset);
43504349
return clear_record_extent_bits(&inode->io_tree, start,
43514350
start + len - 1,
4352-
EXTENT_QGROUP_RESERVED, &changeset);
4351+
EXTENT_QGROUP_RESERVED, NULL);
43534352
}
43544353

43554354
/* In release case, we shouldn't have @reserved */

0 commit comments

Comments
 (0)