Ye Bin
329fc4d3f7
fs/ntfs3: Fix NULL pointer dereference in 'ni_write_inode'
...
[ Upstream commit db2a3cc6a3481076da6344cc62a80a4e2525f36f ]
Syzbot found the following issue:
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000016
Mem abort info:
ESR = 0x0000000096000006
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x06: level 2 translation fault
Data abort info:
ISV = 0, ISS = 0x00000006
CM = 0, WnR = 0
user pgtable: 4k pages, 48-bit VAs, pgdp=000000010af56000
[0000000000000016] pgd=08000001090da003, p4d=08000001090da003, pud=08000001090ce003, pmd=0000000000000000
Internal error: Oops: 0000000096000006 [#1 ] PREEMPT SMP
Modules linked in:
CPU: 1 PID: 3036 Comm: syz-executor206 Not tainted 6.0.0-rc6-syzkaller-17739-g16c9f284e746 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022
pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : is_rec_inuse fs/ntfs3/ntfs.h:313 [inline]
pc : ni_write_inode+0xac/0x798 fs/ntfs3/frecord.c:3232
lr : ni_write_inode+0xa0/0x798 fs/ntfs3/frecord.c:3226
sp : ffff8000126c3800
x29: ffff8000126c3860 x28: 0000000000000000 x27: ffff0000c8b02000
x26: ffff0000c7502320 x25: ffff0000c7502288 x24: 0000000000000000
x23: ffff80000cbec91c x22: ffff0000c8b03000 x21: ffff0000c8b02000
x20: 0000000000000001 x19: ffff0000c75024d8 x18: 00000000000000c0
x17: ffff80000dd1b198 x16: ffff80000db59158 x15: ffff0000c4b6b500
x14: 00000000000000b8 x13: 0000000000000000 x12: ffff0000c4b6b500
x11: ff80800008be1b60 x10: 0000000000000000 x9 : ffff0000c4b6b500
x8 : 0000000000000000 x7 : ffff800008be1b50 x6 : 0000000000000000
x5 : 0000000000000000 x4 : 0000000000000001 x3 : 0000000000000000
x2 : 0000000000000008 x1 : 0000000000000001 x0 : 0000000000000000
Call trace:
is_rec_inuse fs/ntfs3/ntfs.h:313 [inline]
ni_write_inode+0xac/0x798 fs/ntfs3/frecord.c:3232
ntfs_evict_inode+0x54/0x84 fs/ntfs3/inode.c:1744
evict+0xec/0x334 fs/inode.c:665
iput_final fs/inode.c:1748 [inline]
iput+0x2c4/0x324 fs/inode.c:1774
ntfs_new_inode+0x7c/0xe0 fs/ntfs3/fsntfs.c:1660
ntfs_create_inode+0x20c/0xe78 fs/ntfs3/inode.c:1278
ntfs_create+0x54/0x74 fs/ntfs3/namei.c:100
lookup_open fs/namei.c:3413 [inline]
open_last_lookups fs/namei.c:3481 [inline]
path_openat+0x804/0x11c4 fs/namei.c:3688
do_filp_open+0xdc/0x1b8 fs/namei.c:3718
do_sys_openat2+0xb8/0x22c fs/open.c:1311
do_sys_open fs/open.c:1327 [inline]
__do_sys_openat fs/open.c:1343 [inline]
__se_sys_openat fs/open.c:1338 [inline]
__arm64_sys_openat+0xb0/0xe0 fs/open.c:1338
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall arch/arm64/kernel/syscall.c:52 [inline]
el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x48/0x164 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:636
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:654
el0t_64_sync+0x18c/0x190
Code: 97dafee4 340001b4 f9401328 2a1f03e0 (79402d14)
---[ end trace 0000000000000000 ]---
Above issue may happens as follows:
ntfs_new_inode
mi_init
mi->mrec = kmalloc(sbi->record_size, GFP_NOFS); -->failed to allocate memory
if (!mi->mrec)
return -ENOMEM;
iput
iput_final
evict
ntfs_evict_inode
ni_write_inode
is_rec_inuse(ni->mi.mrec)-> As 'ni->mi.mrec' is NULL trigger NULL-ptr-deref
To solve above issue if new inode failed make inode bad before call 'iput()' in
'ntfs_new_inode()'.
Reported-by: syzbot+f45957555ed4a808cc7a@syzkaller.appspotmail.com
Signed-off-by: Ye Bin <yebin10@huawei.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-03-06 14:45:06 +00:00
..
2024-02-05 20:12:59 +00:00
2022-05-09 16:21:44 -04:00
2023-02-01 08:34:08 +01:00
2024-03-01 13:26:36 +01:00
2023-09-23 11:10:59 +02:00
2022-08-02 12:34:03 -04:00
2022-05-09 16:21:44 -04:00
2024-02-23 09:12:29 +01:00
2024-03-01 13:26:32 +01:00
2024-02-23 09:12:46 +01:00
2023-03-10 09:33:52 +01:00
2022-12-31 13:32:22 +01:00
2023-03-10 09:34:09 +01:00
2023-05-11 23:03:00 +09:00
2024-01-20 11:50:04 +01:00
2024-02-16 19:06:29 +01:00
2024-02-05 20:12:49 +00:00
2024-01-25 15:27:20 -08:00
2022-05-09 16:21:45 -04:00
2024-03-01 13:26:39 +01:00
2023-11-28 17:07:00 +00:00
2022-08-17 17:25:04 -04:00
2023-09-23 11:11:05 +02:00
2024-03-01 13:26:28 +01:00
2024-02-16 19:06:31 +01:00
2022-10-11 17:42:58 -06:00
2022-08-02 12:34:03 -04:00
2024-01-31 16:17:04 -08:00
2024-01-01 12:39:08 +00:00
2024-01-25 15:27:22 -08:00
2023-03-10 09:34:07 +01:00
2023-05-24 17:32:34 +01:00
2022-09-19 22:46:25 +02:00
2022-05-09 16:21:45 -04:00
2024-02-23 09:12:46 +01:00
2023-12-08 08:51:20 +01:00
2022-10-12 11:00:22 -07:00
2024-01-20 11:50:07 +01:00
2023-07-19 16:22:11 +02:00
2024-02-05 20:12:48 +00:00
2024-02-05 20:12:58 +00:00
2023-09-13 09:42:49 +02:00
2022-09-24 07:00:00 +02:00
2023-10-06 14:56:32 +02:00
2024-01-25 15:27:23 -08:00
2024-02-23 09:12:50 +01:00
2024-02-23 09:12:52 +01:00
2023-09-13 09:42:22 +02:00
2023-07-19 16:22:05 +02:00
2022-10-12 11:00:22 -07:00
2024-03-06 14:45:06 +00:00
2023-09-13 09:42:33 +02:00
2022-05-09 16:21:44 -04:00
2023-02-09 11:28:04 +01:00
2023-11-28 17:07:12 +00:00
2024-02-23 09:12:47 +01:00
2024-02-05 20:12:48 +00:00
2022-05-09 16:21:44 -04:00
2022-09-11 21:55:07 -07:00
2023-11-28 17:07:13 +00:00
2023-07-19 16:22:11 +02:00
2023-09-13 09:42:27 +02:00
2022-05-09 16:21:46 -04:00
2024-03-01 13:26:30 +01:00
2023-02-22 12:59:50 +01:00
2023-08-11 12:08:23 +02:00
2023-09-23 11:11:12 +02:00
2024-01-31 16:17:02 -08:00
2023-09-13 09:43:05 +02:00
2022-09-11 20:26:07 -07:00
2022-05-09 16:21:46 -04:00
2023-09-13 09:43:03 +02:00
2024-01-31 16:17:08 -08:00
2024-02-23 09:12:45 +01:00
2024-03-01 13:26:39 +01:00
2022-08-20 11:34:04 -04:00
2023-09-23 11:11:10 +02:00
2022-09-24 07:00:00 +02:00
2023-10-06 14:57:06 +02:00
2023-07-01 13:16:25 +02:00
2022-12-31 13:32:57 +01:00
2022-10-12 11:00:22 -07:00
2022-12-31 13:32:41 +01:00
2023-02-22 12:59:50 +01:00
2022-08-20 11:34:33 -04:00
2022-09-24 18:14:12 -07:00
2024-02-05 20:12:54 +00:00
2022-09-20 08:24:38 -06:00
2023-09-13 09:42:27 +02:00
2023-06-21 16:00:54 +02:00
2024-01-31 16:17:07 -08:00
2022-06-10 16:10:23 -04:00
2022-09-01 17:36:39 -04:00
2022-08-16 10:59:54 -04:00
2023-08-11 12:08:23 +02:00
2023-09-13 09:42:28 +02:00
2023-01-07 11:11:59 +01:00
2023-11-20 11:51:50 +01:00
2022-05-19 23:25:10 -04:00
2024-01-10 17:10:32 +01:00
2023-08-30 16:11:10 +02:00
2024-01-31 16:17:00 -08:00
2023-06-28 11:12:40 +02:00
2022-10-10 14:21:11 -07:00
2022-06-16 19:58:21 -07:00
2022-12-31 13:31:58 +01:00
2023-09-23 11:11:00 +02:00
2023-06-28 11:12:40 +02:00
2023-01-07 11:12:02 +01:00
2022-07-05 16:18:21 -04:00
2022-08-03 10:35:43 -07:00
2024-01-31 16:17:02 -08:00
2024-02-23 09:12:46 +01:00
2022-08-20 11:34:04 -04:00
2023-08-11 12:08:22 +02:00
2024-01-31 16:17:09 -08:00
2023-01-04 11:29:01 +01:00
2022-10-10 17:53:04 -07:00
2022-06-28 13:58:05 -04:00
2023-02-09 11:28:04 +01:00
2022-08-17 17:25:04 -04:00
2022-08-05 16:32:45 -07:00
2023-02-09 11:28:04 +01:00
2024-01-10 17:10:31 +01:00
2022-09-11 19:47:12 -05:00
2023-05-24 17:32:51 +01:00
2023-08-11 12:08:24 +02:00
2022-04-26 13:36:25 -07:00
2023-04-26 14:28:37 +02:00
2022-12-31 13:31:55 +01:00