ChenXiaoSong
89840b12c8
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:15:41 +01:00
..
2022-11-25 17:35:37 +01:00
2018-03-11 16:21:35 +01:00
2021-11-26 11:48:42 +01:00
2020-04-24 07:59:00 +02:00
2022-01-27 08:47:38 +01:00
2016-09-26 17:59:49 +02:00
2016-09-26 18:08:44 +02:00
2016-06-07 13:41:38 -06:00
2021-08-08 08:38:53 +02:00
2021-03-24 10:59:22 +01:00
2020-08-26 10:29:03 +02:00
2016-07-26 13:52:25 +02:00
2021-07-20 16:20:59 +02:00
2016-06-25 06:20:10 -07:00
2020-02-14 16:31:07 -05:00
2016-08-03 11:02:51 +01:00
2019-07-10 09:55:46 +02:00
2016-09-26 18:08:44 +02:00
2022-08-25 11:09:27 +02:00
2016-09-26 17:59:49 +02:00
2022-11-10 15:46:07 +01:00
2022-11-10 15:46:07 +01:00
2020-11-18 18:26:24 +01:00
2020-09-12 11:47:35 +02:00
2020-02-28 15:42:12 +01:00
2022-03-16 12:49:01 +01:00
2021-06-10 12:42:36 +02:00
2021-06-16 11:36:34 +02:00
2021-03-03 17:44:36 +01:00
2016-09-26 19:37:04 +02:00
2016-10-12 13:16:00 -07:00
2017-06-24 07:11:17 +02:00
2016-06-06 14:08:28 +02:00
2020-01-29 10:24:31 +01:00
2021-09-22 11:42:57 +02:00
2021-05-22 10:40:16 +02:00
2021-07-20 16:20:59 +02:00
2016-09-26 18:08:44 +02:00
2018-12-08 13:05:11 +01:00
2020-02-28 15:42:53 +01:00
2016-05-30 12:58:21 +01:00
2016-09-26 18:08:44 +02:00
2016-07-26 13:54:22 +02:00
2022-12-08 11:15:41 +01:00
2016-08-25 03:58:21 -07:00
2021-03-11 13:48:03 +01:00
2020-11-10 10:23:57 +01:00
2021-05-22 10:40:17 +02:00
2019-05-31 06:48:12 -07:00
2020-12-29 13:45:05 +01:00
2022-02-23 11:56:39 +01:00
2018-12-08 13:05:12 +01:00
2020-08-26 10:29:03 +02:00
2019-05-31 06:48:12 -07:00
2021-07-20 16:20:56 +02:00
2016-09-26 19:37:04 +02:00
2018-12-08 13:05:13 +01:00
2018-12-08 13:05:12 +01:00
2022-08-25 11:09:28 +02:00
2016-08-25 03:58:32 -07:00
2020-01-04 13:38:57 +01:00
2020-12-11 13:37:58 +01:00
2019-12-21 10:41:57 +01:00
2022-09-05 10:23:56 +02:00
2016-09-26 18:08:44 +02:00