ChenXiaoSong
7ddce74782
ntfs: fix BUG_ON in ntfs_lookup_inode_by_name()
...
commit 1b513f613731e2afc05550e8070d79fac80c661e upstream.
Syzkaller reported BUG_ON as follows:
------------[ cut here ]------------
kernel BUG at fs/ntfs/dir.c:86!
invalid opcode: 0000 [#1 ] PREEMPT SMP KASAN PTI
CPU: 3 PID: 758 Comm: a.out Not tainted 5.19.0-next-20220808 #5
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
RIP: 0010:ntfs_lookup_inode_by_name+0xd11/0x2d10
Code: ff e9 b9 01 00 00 e8 1e fe d6 fe 48 8b 7d 98 49 8d 5d 07 e8 91 85 29 ff 48 c7 45 98 00 00 00 00 e9 5a fb ff ff e8 ff fd d6 fe <0f> 0b e8 f8 fd d6 fe 0f 0b e8 f1 fd d6 fe 48 8b b5 50 ff ff ff 4c
RSP: 0018:ffff888079607978 EFLAGS: 00010293
RAX: 0000000000000000 RBX: 0000000000008000 RCX: 0000000000000000
RDX: ffff88807cf10000 RSI: ffffffff82a4a081 RDI: 0000000000000003
RBP: ffff888079607a70 R08: 0000000000000001 R09: ffff88807a6d01d7
R10: ffffed100f4da03a R11: 0000000000000000 R12: ffff88800f0fb110
R13: ffff88800f0ee000 R14: ffff88800f0fb000 R15: 0000000000000001
FS: 00007f33b63c7540(0000) GS:ffff888108580000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f33b635c090 CR3: 000000000f39e005 CR4: 0000000000770ee0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
PKRU: 55555554
Call Trace:
<TASK>
load_system_files+0x1f7f/0x3620
ntfs_fill_super+0xa01/0x1be0
mount_bdev+0x36a/0x440
ntfs_mount+0x3a/0x50
legacy_get_tree+0xfb/0x210
vfs_get_tree+0x8f/0x2f0
do_new_mount+0x30a/0x760
path_mount+0x4de/0x1880
__x64_sys_mount+0x2b3/0x340
do_syscall_64+0x38/0x90
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f33b62ff9ea
Code: 48 8b 0d a9 f4 0b 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 76 f4 0b 00 f7 d8 64 89 01 48
RSP: 002b:00007ffd0c471aa8 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f33b62ff9ea
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007ffd0c471be0
RBP: 00007ffd0c471c60 R08: 00007ffd0c471ae0 R09: 00007ffd0c471c24
R10: 0000000000000000 R11: 0000000000000202 R12: 000055bac5afc160
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
Fix this by adding sanity check on extended system files' directory inode
to ensure that it is directory, just like ntfs_extend_init() when mounting
ntfs3.
Link: https://lkml.kernel.org/r/20220809064730.2316892-1-chenxiaosong2@huawei.com
Signed-off-by: ChenXiaoSong <chenxiaosong2@huawei.com>
Cc: Anton Altaparmakov <anton@tuxera.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-10-26 13:15:32 +02:00
..
2022-06-25 11:44:57 +02:00
2019-08-06 18:29:35 +02:00
2020-09-12 11:47:39 +02:00
2020-01-29 10:24:34 +01:00
2019-12-21 10:40:46 +01:00
2018-12-01 09:44:19 +01:00
2022-09-05 10:23:56 +02:00
2020-11-10 10:24:00 +01:00
2021-09-26 13:36:18 +02:00
2022-09-28 10:55:44 +02:00
2019-08-06 18:29:38 +02:00
2022-03-02 11:32:03 +01:00
2018-11-13 11:17:03 -08:00
2021-07-20 16:21:11 +02:00
2019-05-08 07:19:10 +02:00
2019-03-23 13:19:47 +01:00
2022-06-14 16:52:34 +02:00
2021-05-26 11:29:07 +02:00
2020-12-02 08:31:28 +01:00
2018-11-27 16:09:38 +01:00
2020-01-29 10:24:03 +01:00
2022-04-20 09:06:35 +02:00
2022-09-28 10:55:47 +02:00
2021-05-22 10:40:30 +02:00
2022-06-14 16:52:30 +02:00
2018-12-17 09:38:34 +01:00
2022-08-25 11:09:24 +02:00
2022-04-27 13:14:10 +02:00
2021-08-04 11:58:02 +02:00
2020-04-24 07:58:59 +02:00
2021-06-03 08:23:33 +02:00
2021-11-12 13:18:02 +01:00
2020-09-03 11:21:19 +02:00
2022-06-14 16:52:38 +02:00
2022-06-14 16:52:30 +02:00
2019-11-25 09:52:23 +01:00
2020-12-29 13:44:57 +01:00
2020-08-21 11:02:06 +02:00
2019-03-13 14:04:52 -07:00
2022-08-25 11:09:28 +02:00
2020-12-29 13:44:59 +01:00
2022-06-06 08:19:46 +02:00
2022-07-21 20:40:30 +02:00
2022-06-14 16:52:31 +02:00
2022-10-26 13:15:32 +02:00
2022-06-14 16:52:34 +02:00
2021-11-26 11:48:38 +01:00
2021-10-17 10:05:38 +02:00
2022-08-25 11:09:21 +02:00
2020-01-12 11:24:20 +01:00
2021-10-06 10:23:41 +02:00
2022-02-23 11:56:39 +01:00
2021-08-15 13:01:04 +02:00
2020-08-26 10:29:03 +02:00
2021-05-22 10:40:32 +02:00
2022-03-23 09:00:34 +01:00
2018-12-17 09:38:32 +01:00
2022-09-20 11:50:16 +02:00
2022-04-20 09:06:40 +02:00
2022-02-08 18:15:26 +01:00
2020-08-21 11:02:11 +02:00
2022-07-12 16:26:24 +02:00
2018-12-21 14:11:31 +01:00
2022-08-25 11:09:23 +02:00
2020-06-03 08:16:42 +02:00
2019-07-10 09:55:38 +02:00
2021-03-17 16:10:18 +01:00
2019-11-06 12:18:04 +01:00
2020-10-01 20:40:12 +02:00
2020-11-10 10:23:56 +01:00
2020-05-20 08:15:32 +02:00
2018-02-25 11:05:55 +01:00
2020-06-30 15:38:35 -04:00
2017-07-05 14:40:26 +02:00
2018-02-28 10:18:33 +01:00
2019-03-27 14:13:04 +09:00
2021-04-16 11:59:07 +02:00
2019-03-13 14:04:58 -07:00
2020-10-14 09:48:13 +02:00
2022-06-06 08:19:46 +02:00
2018-01-31 12:55:52 +01:00
2021-12-08 08:45:06 +01:00
2022-03-02 11:32:07 +01:00
2022-06-14 16:52:34 +02:00
2020-04-02 17:20:27 +02:00
2017-09-20 08:20:01 +02:00
2017-09-20 08:19:59 +02:00
2020-11-24 13:03:05 +01:00
2020-01-12 11:24:13 +01:00
2018-02-22 15:43:48 +01:00
2017-07-21 07:42:22 +02:00
2017-10-18 09:35:39 +02:00
2020-03-11 07:53:07 +01:00
2021-08-26 08:37:29 -04:00
2018-02-17 13:21:15 +01:00
2020-03-20 09:07:44 +01:00
2021-08-15 13:01:03 +02:00
2020-05-02 17:23:20 +02:00
2019-06-11 12:22:49 +02:00
2020-01-04 13:41:06 +01:00
2021-03-24 10:59:25 +01:00
2021-07-20 16:21:16 +02:00
2021-12-14 10:04:48 +01:00
2019-06-11 12:22:45 +02:00
2017-06-14 15:06:01 +02:00
2022-02-23 11:56:39 +01:00
2017-05-08 07:47:54 +02:00
2019-09-06 10:19:37 +02:00
2020-08-21 11:01:55 +02:00