kernel_samsung_a53x/fs/btrfs
Filipe Manana 101b87fc72 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 bed92eae26cc ("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-11-19 14:19:48 +01:00
..
tests Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
acl.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
async-thread.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
async-thread.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
backref.c btrfs: fix information leak in btrfs_ioctl_logical_to_ino() 2024-11-19 11:32:38 +01:00
backref.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
block-group.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
block-group.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
block-rsv.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
block-rsv.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
btrfs_inode.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
check-integrity.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
check-integrity.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
compression.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
compression.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ctree.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ctree.h btrfs: unify lookup return value when dir entry is missing 2024-11-18 22:25:36 +01:00
delalloc-space.c btrfs: don't arbitrarily slow down delalloc if we're committing 2024-11-18 11:43:24 +01:00
delalloc-space.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
delayed-inode.c btrfs: record delayed inode root in transaction 2024-11-19 11:32:21 +01:00
delayed-inode.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
delayed-ref.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
delayed-ref.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dev-replace.c btrfs: dev-replace: properly validate device names 2024-11-18 23:18:29 +01:00
dev-replace.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dir-item.c btrfs: unify lookup return value when dir entry is missing 2024-11-18 22:25:36 +01:00
discard.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
discard.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
disk-io.c btrfs: fix leak of qgroup extent records after transaction abort 2024-11-19 14:19:02 +01:00
disk-io.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
export.c btrfs: export: handle invalid inode or root reference in btrfs_get_parent() 2024-11-19 09:23:13 +01:00
export.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
extent-io-tree.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
extent-tree.c btrfs: don't warn if discard range is not aligned to sector 2024-11-18 12:13:02 +01:00
extent_io.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
extent_io.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
extent_map.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
extent_map.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
file-item.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
file.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
free-space-cache.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
free-space-cache.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
free-space-tree.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
free-space-tree.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
inode-item.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
inode-map.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
inode-map.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
inode.c btrfs: make btrfs_clear_delalloc_extent() free delalloc reserve 2024-11-19 11:32:44 +01:00
ioctl.c btrfs: allocate btrfs_ioctl_defrag_range_args on stack 2024-11-19 09:22:40 +01:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
locking.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
locking.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lzo.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
misc.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ordered-data.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ordered-data.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
orphan.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
print-tree.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
print-tree.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
props.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
props.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
qgroup.c btrfs: qgroup: fix quota root leak after quota disable failure 2024-11-19 14:19:48 +01:00
qgroup.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
raid56.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
raid56.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rcu-string.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reada.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ref-verify.c btrfs: ref-verify: free ref cache before clearing mount opt 2024-11-18 12:13:01 +01:00
ref-verify.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reflink.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reflink.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
relocation.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
root-tree.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
scrub.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
send.c btrfs: fix kvcalloc() arguments order in btrfs_ioctl_send() 2024-11-19 11:32:46 +01:00
send.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
space-info.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
space-info.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
struct-funcs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
super.c Revert "btrfs: add dmesg output for first mount and last unmount of a filesystem" 2024-11-18 12:11:47 +01:00
sysfs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sysfs.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
transaction.c btrfs: always clear PERTRANS metadata during commit 2024-11-19 11:32:44 +01:00
transaction.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tree-checker.c btrfs: tree-checker: check for overlapping extent items 2024-11-18 22:25:35 +01:00
tree-checker.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tree-defrag.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tree-log.c btrfs: unify lookup return value when dir entry is missing 2024-11-18 22:25:36 +01:00
tree-log.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ulist.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ulist.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
uuid-tree.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
volumes.c btrfs: add missing mutex_unlock in btrfs_relocate_sys_chunks() 2024-11-19 12:26:50 +01:00
volumes.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xattr.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xattr.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
zlib.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
zstd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00