In the Linux kernel, the following vulnerability has been resolved:
ext4: fix uninititialized value in 'ext4_evict_inode'
Syzbot found the following issue:
=====================================================BUG: KMSAN: uninit-value in ext4_evict_inode+0xdd/0x26b0fs/ext4/inode.c:180ext4_evict_inode+0xdd/0x26b0fs/ext4/inode.c:180evict+0x365/0x9a0fs/inode.c:664iput_finalfs/inode.c:1747[inline]iput+0x985/0xdd0fs/inode.c:1773__ext4_new_inode+0xe54/0x7ec0fs/ext4/ialloc.c:1361ext4_mknod+0x376/0x840fs/ext4/namei.c:2844vfs_mknod+0x79d/0x830fs/namei.c:3914do_mknodat+0x47d/0xaa0__do_sys_mknodatfs/namei.c:3992[inline]__se_sys_mknodatfs/namei.c:3989[inline]__ia32_sys_mknodat+0xeb/0x150fs/namei.c:3989do_syscall_32_irqs_onarch/x86/entry/common.c:112[inline]__do_fast_syscall_32+0xa2/0x100arch/x86/entry/common.c:178do_fast_syscall_32+0x33/0x70arch/x86/entry/common.c:203do_SYSENTER_32+0x1b/0x20arch/x86/entry/common.c:246entry_SYSENTER_compat_after_hwframe+0x70/0x82Uninit was created at:__alloc_pages+0x9f1/0xe80mm/page_alloc.c:5578alloc_pages+0xaae/0xd80mm/mempolicy.c:2285alloc_slab_pagemm/slub.c:1794[inline]allocate_slab+0x1b5/0x1010mm/slub.c:1939new_slabmm/slub.c:1992[inline]___slab_alloc+0x10c3/0x2d60mm/slub.c:3180__slab_allocmm/slub.c:3279[inline]slab_alloc_nodemm/slub.c:3364[inline]slab_allocmm/slub.c:3406[inline]__kmem_cache_alloc_lrumm/slub.c:3413[inline]kmem_cache_alloc_lru+0x6f3/0xb30mm/slub.c:3429alloc_inode_sbinclude/linux/fs.h:3117[inline]ext4_alloc_inode+0x5f/0x860fs/ext4/super.c:1321alloc_inode+0x83/0x440fs/inode.c:259new_inode_pseudofs/inode.c:1018[inline]new_inode+0x3b/0x430fs/inode.c:1046__ext4_new_inode+0x2a7/0x7ec0fs/ext4/ialloc.c:959ext4_mkdir+0x4d5/0x1560fs/ext4/namei.c:2992vfs_mkdir+0x62a/0x870fs/namei.c:4035do_mkdirat+0x466/0x7b0fs/namei.c:4060__do_sys_mkdiratfs/namei.c:4075[inline]__se_sys_mkdiratfs/namei.c:4073[inline]__ia32_sys_mkdirat+0xc4/0x120fs/namei.c:4073do_syscall_32_irqs_onarch/x86/entry/common.c:112[inline]__do_fast_syscall_32+0xa2/0x100arch/x86/entry/common.c:178do_fast_syscall_32+0x33/0x70arch/x86/entry/common.c:203do_SYSENTER_32+0x1b/0x20arch/x86/entry/common.c:246entry_SYSENTER_compat_after_hwframe+0x70/0x82CPU: 1 PID: 4625 Comm: syz-executor.2 Not tainted 6.1.0-rc4-syzkaller-62821-gcb231e2f67ec #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
=====================================================
Now, 'ext4_alloc_inode()' didn't init 'ei->i_flags'. If new inode failed
before set 'ei->i_flags' in '__ext4_new_inode()', then do 'iput()'. As after
6bc0d63dad7f commit will access 'ei->i_flags' in 'ext4_evict_inode()' which
will lead to access uninit-value.
To solve above issue just init 'ei->i_flags' in 'ext4_alloc_inode()'.