Kernel Tree For Xiaomi 11 Lite NE 5G
Go to file
Namjae Jeon 485d677638 exfat: fix use of uninitialized spinlock on error path
syzbot reported warning message:

Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1d6/0x29e lib/dump_stack.c:118
 register_lock_class+0xf06/0x1520 kernel/locking/lockdep.c:893
 __lock_acquire+0xfd/0x2ae0 kernel/locking/lockdep.c:4320
 lock_acquire+0x148/0x720 kernel/locking/lockdep.c:5029
 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline]
 _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:151
 spin_lock include/linux/spinlock.h:354 [inline]
 exfat_cache_inval_inode+0x30/0x280 fs/exfat/cache.c:226
 exfat_evict_inode+0x124/0x270 fs/exfat/inode.c:660
 evict+0x2bb/0x6d0 fs/inode.c:576
 exfat_fill_super+0x1e07/0x27d0 fs/exfat/super.c:681
 get_tree_bdev+0x3e9/0x5f0 fs/super.c:1342
 vfs_get_tree+0x88/0x270 fs/super.c:1547
 do_new_mount fs/namespace.c:2875 [inline]
 path_mount+0x179d/0x29e0 fs/namespace.c:3192
 do_mount fs/namespace.c:3205 [inline]
 __do_sys_mount fs/namespace.c:3413 [inline]
 __se_sys_mount+0x126/0x180 fs/namespace.c:3390
 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

If exfat_read_root() returns an error, spinlock is used in
exfat_evict_inode() without initialization. This patch combines
exfat_cache_init_inode() with exfat_inode_init_once() to initialize
spinlock by slab constructor.

Fixes: c35b6810c495 ("exfat: add exfat cache")
Cc: stable@vger.kernel.org # v5.7+
Reported-by: syzbot <syzbot+b91107320911a26c9a95@syzkaller.appspotmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
2020-10-12 22:56:52 +09:00
.travis_cmd_wrapper.pl exfat: add travis-CI build and test support 2020-02-03 22:43:47 +09:00
.travis_get_mainline_kernel exfat: add travis-CI build and test support 2020-02-03 22:43:47 +09:00
.travis.yml exfat: enable generic/452 test 2020-06-17 22:08:38 +09:00
balloc.c exfat: remove EXFAT_SB_DIRTY flag 2020-06-17 22:08:32 +09:00
cache.c exfat: fix use of uninitialized spinlock on error path 2020-10-12 22:56:52 +09:00
dir.c exfat: remove 'rwoffset' in exfat_inode_info 2020-10-12 21:38:48 +09:00
exfat_fs.h exfat: fix use of uninitialized spinlock on error path 2020-10-12 22:56:52 +09:00
exfat_raw.h exfat: retain 'VolumeFlags' properly 2020-09-10 09:02:45 +09:00
fatent.c exfat: optimize exfat_zeroed_cluster() 2020-07-03 12:40:21 +09:00
file.c exfat: remove 'rwoffset' in exfat_inode_info 2020-10-12 21:38:48 +09:00
inode.c exfat: fix use of uninitialized spinlock on error path 2020-10-12 22:56:52 +09:00
Kconfig exfat: initial commit 2020-02-03 21:47:19 +09:00
Makefile exfat: linux 4.16 kernel build support 2020-02-04 09:18:10 +09:00
misc.c exfat: fix build error on 32bit & 4.19 lower kernel version 2020-07-03 12:40:25 +09:00
namei.c exfat: replace memcpy with structure assignment 2020-10-12 21:38:45 +09:00
nls.c exfat: fix name_hash computation on big endian systems 2020-07-17 10:23:26 +09:00
README.md exfat: fix typo 2020-02-10 21:35:58 +09:00
super.c exfat: fix use of uninitialized spinlock on error path 2020-10-12 22:56:52 +09:00

exFAT filesystem

This is the exfat filesystem for support from the linux 4.1 kernel to the latest kernel.

Installing as a stand-alone module

Install prerequisite package for Fedora, RHEL:

	yum install kernel-devel-$(uname -r)

Build step:

	make
	sudo make install

To load the driver manually, run this as root:

	modprobe exfat

Installing as a part of the kernel

  1. Let's take [linux] as the path to your kernel source dir.
	cd [linux]
	cp -ar exfat [linux]/fs/
  1. edit [linux]/fs/Kconfig
	source "fs/fat/Kconfig"
	+source "fs/exfat/Kconfig"
	source "fs/ntfs/Kconfig"
  1. edit [linux]/fs/Makefile
	obj-$(CONFIG_FAT_FS)          += fat/
	+obj-$(CONFIG_EXFAT_FS)       += exfat/
	obj-$(CONFIG_BFS_FS)          += bfs/
  1. make menuconfig and set exfat
	File systems  --->
		DOS/FAT/NT Filesystems  --->
			<M> exFAT filesystem support
			(utf8) Default iocharset for exFAT

build your kernel