Yu Kuai
3593093803
reiserfs: add check for root_inode in reiserfs_fill_super
[ Upstream commit 2acf15b94d5b8ea8392c4b6753a6ffac3135cd78 ]
Our syzcaller report a NULL pointer dereference:
BUG: kernel NULL pointer dereference, address: 0000000000000000
PGD 116e95067 P4D 116e95067 PUD 1080b5067 PMD 0
Oops: 0010 [#1] SMP KASAN
CPU: 7 PID: 592 Comm: a.out Not tainted 5.13.0-next-20210629-dirty #67
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20190727_073836-buildvm-p4
RIP: 0010:0x0
Code: Unable to access opcode bytes at RIP 0xffffffffffffffd6.
RSP: 0018:ffff888114e779b8 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 1ffff110229cef39 RCX: ffffffffaa67e1aa
RDX: 0000000000000000 RSI: ffff88810a58ee00 RDI: ffff8881233180b0
RBP: ffffffffac38e9c0 R08: ffffffffaa67e17e R09: 0000000000000001
R10: ffffffffb91c5557 R11: fffffbfff7238aaa R12: ffff88810a58ee00
R13: ffff888114e77aa0 R14: 0000000000000000 R15: ffff8881233180b0
FS: 00007f946163c480(0000) GS:ffff88839f1c0000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffffffffd6 CR3: 00000001099c1000 CR4: 00000000000006e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
__lookup_slow+0x116/0x2d0
? page_put_link+0x120/0x120
? __d_lookup+0xfc/0x320
? d_lookup+0x49/0x90
lookup_one_len+0x13c/0x170
? __lookup_slow+0x2d0/0x2d0
? reiserfs_schedule_old_flush+0x31/0x130
reiserfs_lookup_privroot+0x64/0x150
reiserfs_fill_super+0x158c/0x1b90
? finish_unfinished+0xb10/0xb10
? bprintf+0xe0/0xe0
? __mutex_lock_slowpath+0x30/0x30
? __kasan_check_write+0x20/0x30
? up_write+0x51/0xb0
? set_blocksize+0x9f/0x1f0
mount_bdev+0x27c/0x2d0
? finish_unfinished+0xb10/0xb10
? reiserfs_kill_sb+0x120/0x120
get_super_block+0x19/0x30
legacy_get_tree+0x76/0xf0
vfs_get_tree+0x49/0x160
? capable+0x1d/0x30
path_mount+0xacc/0x1380
? putname+0x97/0xd0
? finish_automount+0x450/0x450
? kmem_cache_free+0xf8/0x5a0
? putname+0x97/0xd0
do_mount+0xe2/0x110
? path_mount+0x1380/0x1380
? copy_mount_options+0x69/0x140
__x64_sys_mount+0xf0/0x190
do_syscall_64+0x35/0x80
entry_SYSCALL_64_after_hwframe+0x44/0xae
This is because 'root_inode' is initialized with wrong mode, and
it's i_op is set to 'reiserfs_special_inode_operations'. Thus add
check for 'root_inode' to fix the problem.
Link: https://lore.kernel.org/r/20210702040743.1918552-1-yukuai3@huawei.com
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-08-15 13:03:32 +02:00
..
2020-11-05 11:07:03 +01:00
2019-08-06 19:05:21 +02:00
2021-03-03 18:22:54 +01:00
2020-04-02 16:34:33 +02:00
2019-12-17 20:37:24 +01:00
2018-12-01 09:42:51 +01:00
2021-08-08 08:53:29 +02:00
2020-11-05 11:07:05 +01:00
2021-07-20 16:17:52 +02:00
2021-06-03 08:36:22 +02:00
2019-08-06 19:05:23 +02:00
2021-07-20 16:17:41 +02:00
2018-11-13 11:15:12 -08:00
2021-07-20 16:17:45 +02:00
2019-05-08 07:20:49 +02:00
2019-03-23 14:35:21 +01:00
2021-07-20 16:17:33 +02:00
2021-05-26 11:47:00 +02:00
2020-12-02 08:34:44 +01:00
2019-12-05 15:37:28 +01:00
2020-01-27 14:46:06 +01:00
2020-08-21 09:48:18 +02:00
2021-08-15 13:03:31 +02:00
2021-07-20 16:17:53 +02:00
2020-06-20 10:25:05 +02:00
2018-12-17 09:28:53 +01:00
2021-07-20 16:17:45 +02:00
2021-06-30 08:48:46 -04:00
2021-08-04 12:22:15 +02:00
2020-04-24 08:00:45 +02:00
2021-06-03 08:36:25 +02:00
2021-03-03 18:22:46 +01:00
2020-09-03 11:22:29 +02:00
2021-05-22 10:57:22 +02:00
2021-07-20 16:17:49 +02:00
2021-06-30 08:48:55 -04:00
2020-12-29 13:46:57 +01:00
2020-08-21 09:48:15 +02:00
2021-07-20 16:17:54 +02:00
2020-12-29 13:47:01 +01:00
2021-01-23 15:48:45 +01:00
2021-06-30 08:48:59 -04:00
2020-01-12 12:11:59 +01:00
2021-07-20 16:17:28 +02:00
2021-08-04 12:22:15 +02:00
2021-07-20 16:17:52 +02:00
2021-02-23 14:00:31 +01:00
2021-07-28 11:12:18 +02:00
2020-01-09 10:17:55 +01:00
2021-03-03 18:22:44 +01:00
2020-10-29 09:07:11 +01:00
2021-08-15 13:03:32 +02:00
2020-08-26 10:29:54 +02:00
2021-05-22 10:57:39 +02:00
2021-06-30 08:48:55 -04:00
2018-12-17 09:28:48 +01:00
2021-07-20 16:17:54 +02:00
2021-07-20 16:17:42 +02:00
2020-08-21 09:48:22 +02:00
2021-03-07 11:27:43 +01:00
2018-12-21 14:13:04 +01:00
2020-06-03 08:18:03 +02:00
2019-07-03 13:15:59 +02:00
2021-03-17 16:34:35 +01:00
2019-11-06 12:42:59 +01:00
2021-05-22 10:57:43 +02:00
2020-11-05 11:06:58 +01:00
2020-01-14 20:05:39 +01:00
2020-01-09 10:17:58 +01:00
2020-05-20 08:16:58 +02:00
2020-03-11 18:02:43 +01:00
2019-02-06 17:31:34 +01:00
2021-04-16 11:57:48 +02:00
2020-01-12 12:11:59 +01:00
2020-10-14 09:51:09 +02:00
2020-11-18 18:28:03 +01:00
2020-05-27 16:42:51 +02:00
2020-04-24 08:00:43 +02:00
2021-07-20 16:17:37 +02:00
2020-04-02 16:34:21 +02:00
2018-11-10 07:48:33 -08:00
2019-12-17 20:38:57 +01:00
2020-11-24 13:05:50 +01:00
2020-01-09 10:17:55 +01:00
2020-03-11 18:02:53 +01:00
2020-05-02 17:24:20 +02:00
2020-03-20 10:54:16 +01:00
2021-08-15 13:03:31 +02:00
2020-05-02 17:24:47 +02:00
2019-12-01 09:13:51 +01:00
2021-04-28 12:08:41 +02:00
2021-03-24 11:05:05 +01:00
2021-07-20 16:17:55 +02:00
2019-05-04 09:15:18 +02:00
2019-10-11 18:18:48 +02:00
2020-11-24 13:05:44 +01:00
2020-01-04 13:59:58 +01:00
2020-08-21 09:48:00 +02:00