Zhang Xiaoxu
c914c56ac0
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:42:09 +01:00
..
2022-11-25 17:42:09 +01:00
2019-04-29 19:02:44 +02:00
2021-11-26 10:47:21 +01:00
2020-04-17 10:50:15 +02:00
2022-11-10 17:57:52 +01:00
2019-07-01 13:34:53 +02:00
2022-08-25 11:18:11 +02:00
2021-03-20 10:39:46 +01:00
2020-06-22 09:31:13 +02:00
2019-07-02 12:30:55 +02:00
2021-09-03 10:08:15 +02:00
2020-02-24 08:36:53 +01:00
2021-08-04 12:27:37 +02:00
2019-09-09 14:59:11 +02:00
2022-01-27 09:19:50 +01:00
2022-09-05 10:27:46 +02:00
2021-08-15 13:08:04 +02:00
2019-07-04 17:26:17 +02:00
2021-08-15 13:08:06 +02:00
2020-02-11 04:35:34 -08:00
2019-07-04 17:26:17 +02:00
2022-09-05 10:27:43 +02:00
2019-04-29 19:02:43 +02:00
2022-09-05 10:27:46 +02:00
2022-08-25 11:18:16 +02:00
2019-09-09 14:59:11 +02:00
2022-11-10 17:57:55 +01:00
2022-11-10 17:57:55 +01:00
2021-12-14 14:49:01 +01:00
2022-04-15 14:18:39 +02:00
2020-02-19 19:53:00 +01:00
2021-10-20 11:40:13 +02:00
2021-06-10 13:37:13 +02:00
2021-09-03 10:08:15 +02:00
2021-08-08 09:04:07 +02:00
2019-09-09 14:59:15 +02:00
2021-02-03 23:25:57 +01:00
2019-09-09 14:59:03 +02:00
2019-09-09 14:59:16 +02:00
2019-10-15 18:50:07 +02:00
2022-09-05 10:27:46 +02:00
2022-02-01 17:24:39 +01:00
2021-07-14 16:53:14 +02:00
2019-09-09 14:59:15 +02:00
2019-09-09 14:58:59 +02:00
2019-09-09 14:59:11 +02:00
2019-09-09 14:59:04 +02:00
2019-09-09 14:59:15 +02:00
2020-02-28 17:22:24 +01:00
2019-07-01 13:35:00 +02:00
2020-09-17 13:47:51 +02:00
2019-09-09 14:59:13 +02:00
2019-04-29 19:02:54 +02:00
2022-10-26 13:22:16 +02:00
2021-08-15 13:08:06 +02:00
2022-08-25 11:18:40 +02:00
2019-07-01 13:34:58 +02:00
2020-11-05 11:43:27 +01:00
2020-11-18 19:20:28 +01:00
2019-04-29 19:02:49 +02:00
2021-05-11 14:04:07 +02:00
2022-09-05 10:27:43 +02:00
2022-10-26 13:22:55 +02:00
2022-02-23 11:59:55 +01:00
2021-09-30 10:09:22 +02:00
2020-10-17 10:11:21 +02:00
2019-09-09 14:59:16 +02:00
2021-01-19 18:26:14 +01:00
2020-08-21 13:05:22 +02:00
2019-09-09 14:59:08 +02:00
2021-08-15 13:08:05 +02:00
2021-09-03 10:08:15 +02:00
2022-09-05 10:27:47 +02:00
2019-04-29 19:02:39 +02:00
2022-09-05 10:27:46 +02:00
2021-08-08 09:04:07 +02:00
2019-12-31 16:42:05 +01:00
2022-09-15 12:04:53 +02:00
2020-11-05 11:43:27 +01:00
2022-09-05 10:27:43 +02:00
2019-04-29 19:02:44 +02:00
2019-09-09 14:59:11 +02:00
2019-09-09 14:59:15 +02:00