Filipe Manana
26b7c0ac49
btrfs: fix race between quota enable and quota rescan ioctl
...
commit 331cd9461412e103d07595a10289de90004ac890 upstream.
When enabling quotas, at btrfs_quota_enable(), after committing the
transaction, we change fs_info->quota_root to point to the quota root we
created and set BTRFS_FS_QUOTA_ENABLED at fs_info->flags. Then we try
to start the qgroup rescan worker, first by initializing it with a call
to qgroup_rescan_init() - however if that fails we end up freeing the
quota root but we leave fs_info->quota_root still pointing to it, this
can later result in a use-after-free somewhere else.
We have previously set the flags BTRFS_FS_QUOTA_ENABLED and
BTRFS_QGROUP_STATUS_FLAG_ON, so we can only fail with -EINPROGRESS at
btrfs_quota_enable(), which is possible if someone already called the
quota rescan ioctl, and therefore started the rescan worker.
So fix this by ignoring an -EINPROGRESS and asserting we can't get any
other error.
Reported-by: Ye Bin <[email protected] >
Link: https://lore.kernel.org/linux-btrfs/[email protected] /
CC: [email protected] # 4.19+
Reviewed-by: Qu Wenruo <[email protected] >
Signed-off-by: Filipe Manana <[email protected] >
Signed-off-by: David Sterba <[email protected] >
Signed-off-by: Greg Kroah-Hartman <[email protected] >
2022-10-26 13:22:16 +02:00
..
tests
acl.c
async-thread.c
btrfs: fix memory ordering between normal and ordered work functions
2021-11-26 10:47:21 +01:00
async-thread.h
backref.c
btrfs: remove BUG_ON(!eie) in find_parent_nodes
2022-01-27 09:19:45 +01:00
backref.h
block-group.c
btrfs: reset block group chunk force if we have to wait
2022-08-25 11:18:11 +02:00
block-group.h
btrfs: scrub: Don't check free space before marking a block group RO
2021-03-20 10:39:46 +01:00
block-rsv.c
block-rsv.h
btrfs_inode.h
btrfs: fix race between marking inode needs to be logged and log syncing
2021-09-03 10:08:15 +02:00
check-integrity.c
check-integrity.h
compression.c
btrfs: mark compressed range uptodate only if all bio succeed
2021-08-04 12:27:37 +02:00
compression.h
ctree.c
btrfs: check the root node for uptodate before returning it
2022-01-27 09:19:50 +01:00
ctree.h
btrfs: unify lookup return value when dir entry is missing
2022-09-05 10:27:46 +02:00
delalloc-space.c
btrfs: make btrfs_qgroup_reserve_data take btrfs_inode
2021-08-15 13:08:04 +02:00
delalloc-space.h
delayed-inode.c
btrfs: don't flush from btrfs_delayed_inode_reserve_metadata
2021-08-15 13:08:06 +02:00
delayed-inode.h
delayed-ref.c
delayed-ref.h
dev-replace.c
btrfs: add info when mount fails due to stale replace target
2022-09-05 10:27:43 +02:00
dev-replace.h
dir-item.c
btrfs: unify lookup return value when dir entry is missing
2022-09-05 10:27:46 +02:00
disk-io.c
btrfs: reject log replay if there is unsupported RO compat flag
2022-08-25 11:18:16 +02:00
disk-io.h
export.c
export.h
extent-tree.c
btrfs: unlock newly allocated extent buffer after error
2021-10-20 11:40:13 +02:00
extent_io.c
btrfs: clear extent buffer uptodate when we fail to write it
2021-12-14 14:49:01 +01:00
extent_io.h
btrfs: fix qgroup reserve overflow the qgroup limit
2022-04-15 14:18:39 +02:00
extent_map.c
extent_map.h
file-item.c
btrfs: fix error handling in btrfs_del_csums
2021-06-10 13:37:13 +02:00
file.c
btrfs: fix race between marking inode needs to be logged and log syncing
2021-09-03 10:08:15 +02:00
free-space-cache.c
btrfs: delete duplicated words + other fixes in comments
2021-08-08 09:04:07 +02:00
free-space-cache.h
free-space-tree.c
btrfs: fix possible free space tree corruption with online conversion
2021-02-03 23:25:57 +01:00
free-space-tree.h
inode-item.c
inode-map.c
inode-map.h
inode.c
btrfs: do not pin logs too early during renames
2022-09-05 10:27:46 +02:00
ioctl.c
fsnotify: invalidate dcache before IN_DELETE event
2022-02-01 17:24:39 +01:00
Kconfig
btrfs: disable build on platforms having page size 256K
2021-07-14 16:53:14 +02:00
locking.c
locking.h
lzo.c
Makefile
misc.h
ordered-data.c
ordered-data.h
orphan.c
print-tree.c
print-tree.h
props.c
props.h
qgroup.c
btrfs: fix race between quota enable and quota rescan ioctl
2022-10-26 13:22:16 +02:00
qgroup.h
btrfs: export and rename qgroup_reserve_meta
2021-08-15 13:08:06 +02:00
raid56.c
btrfs: raid56: don't trust any cached sector in __raid56_parity_recover()
2022-08-25 11:18:40 +02:00
raid56.h
rcu-string.h
reada.c
btrfs: fix readahead hang and use-after-free after removing a device
2020-11-05 11:43:27 +01:00
ref-verify.c
btrfs: ref-verify: fix memory leak in btrfs_ref_tree_mod
2020-11-18 19:20:28 +01:00
ref-verify.h
relocation.c
btrfs: convert logic BUG_ON()'s in replace_path to ASSERT()'s
2021-05-11 14:04:07 +02:00
root-tree.c
btrfs: fix silent failure when deleting root reference
2022-09-05 10:27:43 +02:00
scrub.c
btrfs: scrub: Don't check free space before marking a block group RO
2021-03-20 10:39:46 +01:00
send.c
btrfs: send: in case of IO error log it
2022-02-23 11:59:55 +01:00
send.h
space-info.c
btrfs: prevent __btrfs_dump_space_info() to underflow its free space
2021-09-30 10:09:22 +02:00
space-info.h
struct-funcs.c
super.c
btrfs: fix transaction leak and crash after RO remount caused by qgroup rescan
2021-01-19 18:26:14 +01:00
sysfs.c
sysfs.h
transaction.c
btrfs: qgroup: remove ASYNC_COMMIT mechanism in favor of reserve retry-after-EDQUOT
2021-08-15 13:08:05 +02:00
transaction.h
btrfs: fix race between marking inode needs to be logged and log syncing
2021-09-03 10:08:15 +02:00
tree-checker.c
btrfs: tree-checker: check for overlapping extent items
2022-09-05 10:27:47 +02:00
tree-checker.h
tree-defrag.c
tree-log.c
btrfs: unify lookup return value when dir entry is missing
2022-09-05 10:27:46 +02:00
tree-log.h
btrfs: do not commit logs and transactions during link and rename operations
2021-08-08 09:04:07 +02:00
ulist.c
ulist.h
uuid-tree.c
volumes.c
btrfs: harden identification of a stale device
2022-09-15 12:04:53 +02:00
volumes.h
btrfs: fix readahead hang and use-after-free after removing a device
2020-11-05 11:43:27 +01:00
xattr.c
btrfs: check if root is readonly while setting security xattr
2022-09-05 10:27:43 +02:00
xattr.h
zlib.c
zstd.c