WSL2-Linux-Kernel/fs/btrfs
Filipe Manana 8a69529f22 btrfs: qgroup: fix quota root leak after quota disable failure
[ Upstream commit a7e4c6a3031c74078dba7fa36239d0f4fe476c53 ]

If during the quota disable we fail when cleaning the quota tree or when
deleting the root from the root tree, we jump to the 'out' label without
ever dropping the reference on the quota root, resulting in a leak of the
root since fs_info->quota_root is no longer pointing to the root (we have
set it to NULL just before those steps).

Fix this by always doing a btrfs_put_root() call under the 'out' label.
This is a problem that exists since qgroups were first added in 2012 by
commit bed92eae26 ("Btrfs: qgroup implementation and prototypes"), but
back then we missed a kfree on the quota root and free_extent_buffer()
calls on its root and commit root nodes, since back then roots were not
yet reference counted.

Reviewed-by: Boris Burkov <boris@bur.io>
Reviewed-by: Qu Wenruo <wqu@suse.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: Sasha Levin <sashal@kernel.org>
2024-07-27 10:46:12 +02:00
..
tests
Kconfig
Makefile
acl.c
async-thread.c
async-thread.h
backref.c btrfs: fix information leak in btrfs_ioctl_logical_to_ino() 2024-05-02 16:24:48 +02:00
backref.h
block-group.c btrfs: fix adding block group to a reclaim list and the unused list during reclaim 2024-07-18 13:07:32 +02:00
block-group.h
block-rsv.c
block-rsv.h
btrfs_inode.h
check-integrity.c
check-integrity.h
compression.c
compression.h
ctree.c
ctree.h
delalloc-space.c
delalloc-space.h
delayed-inode.c btrfs: record delayed inode root in transaction 2024-04-27 17:05:22 +02:00
delayed-inode.h
delayed-ref.c
delayed-ref.h
dev-replace.c
dev-replace.h
dir-item.c
discard.c
discard.h
disk-io.c btrfs: fix leak of qgroup extent records after transaction abort 2024-07-05 09:14:13 +02:00
disk-io.h
export.c btrfs: export: handle invalid inode or root reference in btrfs_get_parent() 2024-04-13 13:01:44 +02:00
export.h
extent-io-tree.h
extent-tree.c
extent_io.c
extent_io.h
extent_map.c
extent_map.h
file-item.c
file.c
free-space-cache.c
free-space-cache.h
free-space-tree.c
free-space-tree.h
inode-item.c
inode.c btrfs: make btrfs_clear_delalloc_extent() free delalloc reserve 2024-05-17 11:50:54 +02:00
ioctl.c
locking.c
locking.h
lzo.c
misc.h
ordered-data.c
ordered-data.h
orphan.c
print-tree.c
print-tree.h
props.c
props.h
qgroup.c btrfs: qgroup: fix quota root leak after quota disable failure 2024-07-27 10:46:12 +02:00
qgroup.h
raid56.c
raid56.h
rcu-string.h
reada.c
ref-verify.c
ref-verify.h
reflink.c
reflink.h
relocation.c
root-tree.c
scrub.c
send.c btrfs: fix kvcalloc() arguments order in btrfs_ioctl_send() 2024-05-17 11:51:01 +02:00
send.h
space-info.c
space-info.h
struct-funcs.c
subpage.c
subpage.h
super.c
sysfs.c
sysfs.h
transaction.c btrfs: always clear PERTRANS metadata during commit 2024-05-17 11:50:54 +02:00
transaction.h
tree-checker.c
tree-checker.h
tree-defrag.c
tree-log.c
tree-log.h
tree-mod-log.c
tree-mod-log.h
ulist.c
ulist.h
uuid-tree.c
verity.c
volumes.c btrfs: add missing mutex_unlock in btrfs_relocate_sys_chunks() 2024-05-17 11:51:03 +02:00
volumes.h
xattr.c
xattr.h
zlib.c
zoned.c
zoned.h
zstd.c