Zhang Xiaoxu
33eb72a6e1
btrfs: selftests: fix wrong error check in btrfs_free_dummy_root()
...
commit 9b2f20344d450137d015b380ff0c2e2a6a170135 upstream.
The btrfs_alloc_dummy_root() uses ERR_PTR as the error return value
rather than NULL, if error happened, there will be a NULL pointer
dereference:
BUG: KASAN: null-ptr-deref in btrfs_free_dummy_root+0x21/0x50 [btrfs]
Read of size 8 at addr 000000000000002c by task insmod/258926
CPU: 2 PID: 258926 Comm: insmod Tainted: G W 6.1.0-rc2+ #5
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-1.fc33 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0x34/0x44
kasan_report+0xb7/0x140
kasan_check_range+0x145/0x1a0
btrfs_free_dummy_root+0x21/0x50 [btrfs]
btrfs_test_free_space_cache+0x1a8c/0x1add [btrfs]
btrfs_run_sanity_tests+0x65/0x80 [btrfs]
init_btrfs_fs+0xec/0x154 [btrfs]
do_one_initcall+0x87/0x2a0
do_init_module+0xdf/0x320
load_module+0x3006/0x3390
__do_sys_finit_module+0x113/0x1b0
do_syscall_64+0x35/0x80
entry_SYSCALL_64_after_hwframe+0x46/0xb0
Fixes: aaedb55bc08f ("Btrfs: add tests for btrfs_get_extent")
CC: stable@vger.kernel.org # 4.9+
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-11-25 17:35:37 +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
2016-03-11 17:12:46 +01: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-04-28 10:59:13 +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
2016-01-15 19:22:28 +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
2015-12-17 12:16:47 -08:00
2017-06-24 07:11:17 +02:00
2016-06-06 14:08:28 +02:00
2016-04-28 10:36:54 +02:00
2020-01-29 10:24:31 +01:00
2016-01-15 19:25:02 +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-01-07 14:30:52 +01: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
2020-12-29 13:45:04 +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
2016-01-07 14:38:02 +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
2016-01-21 18:50:40 +01: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
2015-12-18 02:51:32 +00:00
2022-08-25 11:09:28 +02:00
2016-08-25 03:58:32 -07:00
2016-05-25 22:35:14 +02: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-05-17 19:17:09 -04:00
2016-09-26 18:08:44 +02:00