btrfs: qgroup: don't use extent changeset when not needed
BugLink: https://bugs.launchpad.net/bugs/2085849
commit c346c629765ab982967017e2ae859156d0e235cf upstream.
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: af0e2aab3b ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Manuel Diewald <manuel.diewald@canonical.com>
Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
This commit is contained in:
committed by
Mehmet Basaran
parent
27eb52d5f1
commit
0644221475
+1
-2
@@ -4210,10 +4210,9 @@ static int __btrfs_qgroup_release_data(struct btrfs_inode *inode,
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (btrfs_qgroup_mode(inode->root->fs_info) == BTRFS_QGROUP_MODE_DISABLED) {
|
if (btrfs_qgroup_mode(inode->root->fs_info) == BTRFS_QGROUP_MODE_DISABLED) {
|
||||||
extent_changeset_init(&changeset);
|
|
||||||
return clear_record_extent_bits(&inode->io_tree, start,
|
return clear_record_extent_bits(&inode->io_tree, start,
|
||||||
start + len - 1,
|
start + len - 1,
|
||||||
EXTENT_QGROUP_RESERVED, &changeset);
|
EXTENT_QGROUP_RESERVED, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* In release case, we shouldn't have @reserved */
|
/* In release case, we shouldn't have @reserved */
|
||||||
|
|||||||
Reference in New Issue
Block a user