ChenXiaoSong
044da1a371
btrfs: qgroup: fix sleep from invalid context bug in btrfs_qgroup_inherit()
...
[ Upstream commit f7e942b5bb35d8e3af54053d19a6bf04143a3955 ]
Syzkaller reported BUG as follows:
BUG: sleeping function called from invalid context at
include/linux/sched/mm.h:274
Call Trace:
<TASK>
dump_stack_lvl+0xcd/0x134
__might_resched.cold+0x222/0x26b
kmem_cache_alloc+0x2e7/0x3c0
update_qgroup_limit_item+0xe1/0x390
btrfs_qgroup_inherit+0x147b/0x1ee0
create_subvol+0x4eb/0x1710
btrfs_mksubvol+0xfe5/0x13f0
__btrfs_ioctl_snap_create+0x2b0/0x430
btrfs_ioctl_snap_create_v2+0x25a/0x520
btrfs_ioctl+0x2a1c/0x5ce0
__x64_sys_ioctl+0x193/0x200
do_syscall_64+0x35/0x80
Fix this by calling qgroup_dirty() on @dstqgroup, and update limit item in
btrfs_run_qgroups() later outside of the spinlock context.
CC: stable@vger.kernel.org # 4.9+
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: ChenXiaoSong <chenxiaosong2@huawei.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-12-08 11:28:38 +01:00
..
2022-11-26 09:24:32 +01:00
2021-09-02 09:21:27 -07:00
2021-11-25 09:48:46 +01:00
2022-12-08 11:28:38 +01:00
2022-12-08 11:28:38 +01:00
2022-10-29 10:12:53 +02:00
2022-09-05 10:30:12 +02:00
2020-12-08 15:53:41 +01:00
2022-08-31 17:16:35 +02:00
2022-07-21 21:24:32 +02:00
2022-04-20 09:34:04 +02:00
2021-08-23 13:19:04 +02:00
2022-09-05 10:30:12 +02:00
2022-09-05 10:30:12 +02:00
2022-08-31 17:16:34 +02:00
2020-07-27 12:55:36 +02:00
2021-08-23 13:19:09 +02:00
2020-12-08 15:54:10 +01:00
2021-07-22 15:50:07 +02:00
2022-07-12 16:34:50 +02:00
2022-08-31 17:16:46 +02:00
2021-02-09 02:46:07 +01:00
2021-10-07 22:06:32 +02:00
2021-06-22 14:11:57 +02:00
2020-12-08 15:54:02 +01:00
2022-11-16 09:58:27 +01:00
2022-09-05 10:30:12 +02:00
2022-11-10 18:15:38 +01:00
2022-11-10 18:15:38 +01:00
2022-09-05 10:30:12 +02:00
2022-04-13 20:59:23 +02:00
2022-07-21 21:24:32 +02:00
2020-12-08 15:54:13 +01:00
2022-11-10 18:15:37 +01:00
2022-04-08 14:23:58 +02:00
2022-11-10 18:15:37 +01:00
2022-10-26 12:35:44 +02:00
2021-02-09 02:46:03 +01:00
2022-07-12 16:34:50 +02:00
2020-12-08 15:54:02 +01:00
2022-09-05 10:30:09 +02:00
2022-12-08 11:28:38 +01:00
2021-06-22 14:11:57 +02:00
2022-09-05 10:30:12 +02:00
2022-09-05 10:30:12 +02:00
2022-03-02 11:48:07 +01:00
2021-08-23 13:19:09 +02:00
2021-09-07 14:29:50 +02:00
2021-09-07 14:30:41 +02:00
2021-08-23 13:19:02 +02:00
2021-01-07 17:25:05 +01:00
2021-01-07 17:25:05 +01:00
2021-06-22 14:11:58 +02:00
2022-12-08 11:28:38 +01:00
2021-07-22 15:50:07 +02:00
2022-11-26 09:24:31 +01:00
2022-07-21 21:24:32 +02:00
2022-07-21 21:24:32 +02:00
2021-08-23 13:19:00 +02:00
2022-04-08 14:23:11 +02:00
2022-09-05 10:30:12 +02:00
2022-08-31 17:16:46 +02:00
2022-10-26 12:35:44 +02:00
2022-03-16 14:23:46 +01:00
2020-10-07 12:13:17 +02:00
2022-04-08 14:23:02 +02:00
2021-06-22 14:55:25 +02:00
2021-08-23 13:18:58 +02:00
2021-08-23 13:19:05 +02:00
2021-08-23 13:19:04 +02:00
2022-10-29 10:12:53 +02:00
2022-12-02 17:41:12 +01:00
2020-10-07 12:12:21 +02:00
2022-03-16 14:23:46 +01:00
2022-03-08 19:12:54 +01:00
2022-09-05 10:30:12 +02:00
2020-12-08 15:54:01 +01:00
2022-09-05 10:30:09 +02:00
2022-08-31 17:16:36 +02:00
2021-04-20 19:27:17 +02:00
2021-04-19 17:25:17 +02:00
2020-12-08 15:53:52 +01:00
2021-09-17 19:29:41 +02:00
2022-11-16 09:58:27 +01:00
2022-11-16 09:58:27 +01:00
2022-08-31 17:16:46 +02:00
2021-10-29 13:03:05 +02:00
2022-12-02 17:41:12 +01:00
2022-08-31 17:16:34 +02:00
2021-10-29 13:02:50 +02:00