Kernel Tree For Xiaomi 11 Lite NE 5G
Go to file
Chao Yu 7361c9f2bd f2fs: fix to do sanity check on block address in f2fs_do_zero_range()
commit 25f8236213a91efdf708b9d77e9e51b6fc3e141c upstream.

As Yanming reported in bugzilla:

https://bugzilla.kernel.org/show_bug.cgi?id=215894

I have encountered a bug in F2FS file system in kernel v5.17.

I have uploaded the system call sequence as case.c, and a fuzzed image can
be found in google net disk

The kernel should enable CONFIG_KASAN=y and CONFIG_KASAN_INLINE=y. You can
reproduce the bug by running the following commands:

kernel BUG at fs/f2fs/segment.c:2291!
Call Trace:
 f2fs_invalidate_blocks+0x193/0x2d0
 f2fs_fallocate+0x2593/0x4a70
 vfs_fallocate+0x2a5/0xac0
 ksys_fallocate+0x35/0x70
 __x64_sys_fallocate+0x8e/0xf0
 do_syscall_64+0x3b/0x90
 entry_SYSCALL_64_after_hwframe+0x44/0xae

The root cause is, after image was fuzzed, block mapping info in inode
will be inconsistent with SIT table, so in f2fs_fallocate(), it will cause
panic when updating SIT with invalid blkaddr.

Let's fix the issue by adding sanity check on block address before updating
SIT table with it.

Cc: stable@vger.kernel.org
Reported-by: Ming Yan <yanming@tju.edu.cn>
Signed-off-by: Chao Yu <chao.yu@oppo.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-14 18:11:44 +02:00
arch powerpc/fsl_rio: Fix refcount leak in fsl_rio_setup 2022-06-14 18:11:42 +02:00
block block: return ELEVATOR_DISCARD_MERGE if possible 2022-05-25 09:14:38 +02:00
certs
crypto crypto: cryptd - Protect per-CPU resource by disabling BH. 2022-06-14 18:11:41 +02:00
Documentation hwmon: Make chip parameter for with_info API mandatory 2022-06-14 18:11:29 +02:00
drivers iommu/amd: Increase timeout waiting for GA log enablement 2022-06-14 18:11:43 +02:00
fs f2fs: fix to do sanity check on block address in f2fs_do_zero_range() 2022-06-14 18:11:44 +02:00
include mailbox: forward the hrtimer if not queued and under a lock 2022-06-14 18:11:42 +02:00
init init/main.c: return 1 from handled __setup() functions 2022-04-15 14:18:35 +02:00
ipc ipc/mqueue: use get_tree_nodev() in mqueue_get_tree() 2022-06-14 18:11:41 +02:00
kernel sched/fair: Fix cfs_rq_clock_pelt() for throttled cfs_rq 2022-06-14 18:11:33 +02:00
lib assoc_array: Fix BUG_ON during garbage collect 2022-06-06 08:33:50 +02:00
LICENSES
mm zsmalloc: fix races between asynchronous zspage free and page migration 2022-06-06 08:33:50 +02:00
net net/smc: postpone sk_refcnt increment in connect() 2022-06-14 18:11:39 +02:00
samples
scripts scripts/faddr2line: Fix overlapping text section failures 2022-06-14 18:11:37 +02:00
security lockdown: also lock down previous kgdb use 2022-06-06 08:33:48 +02:00
sound ASoC: wm2000: fix missing clk_disable_unprepare() on error in wm2000_anc_transition() 2022-06-14 18:11:38 +02:00
tools perf jevents: Fix event syntax error caused by ExtSel 2022-06-14 18:11:44 +02:00
usr
virt KVM: Prevent module exit until all VMs are freed 2022-04-15 14:18:27 +02:00
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile Linux 5.4.197 2022-06-06 08:33:51 +02:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.