Go to file
Fedor Pchelkin d1b81776f3 jffs2: check jffs2_prealloc_raw_node_refs() result in few other places
commit 2b6d965032 upstream.

Fuzzing hit another invalid pointer dereference due to the lack of
checking whether jffs2_prealloc_raw_node_refs() completed successfully.
Subsequent logic implies that the node refs have been allocated.

Handle that. The code is ready for propagating the error upwards.

KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
CPU: 1 PID: 5835 Comm: syz-executor145 Not tainted 5.10.234-syzkaller #0
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
RIP: 0010:jffs2_link_node_ref+0xac/0x690 fs/jffs2/nodelist.c:600
Call Trace:
 jffs2_mark_erased_block fs/jffs2/erase.c:460 [inline]
 jffs2_erase_pending_blocks+0x688/0x1860 fs/jffs2/erase.c:118
 jffs2_garbage_collect_pass+0x638/0x1a00 fs/jffs2/gc.c:253
 jffs2_reserve_space+0x3f4/0xad0 fs/jffs2/nodemgmt.c:167
 jffs2_write_inode_range+0x246/0xb50 fs/jffs2/write.c:362
 jffs2_write_end+0x712/0x1110 fs/jffs2/file.c:302
 generic_perform_write+0x2c2/0x500 mm/filemap.c:3347
 __generic_file_write_iter+0x252/0x610 mm/filemap.c:3465
 generic_file_write_iter+0xdb/0x230 mm/filemap.c:3497
 call_write_iter include/linux/fs.h:2039 [inline]
 do_iter_readv_writev+0x46d/0x750 fs/read_write.c:740
 do_iter_write+0x18c/0x710 fs/read_write.c:866
 vfs_writev+0x1db/0x6a0 fs/read_write.c:939
 do_pwritev fs/read_write.c:1036 [inline]
 __do_sys_pwritev fs/read_write.c:1083 [inline]
 __se_sys_pwritev fs/read_write.c:1078 [inline]
 __x64_sys_pwritev+0x235/0x310 fs/read_write.c:1078
 do_syscall_64+0x30/0x40 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x67/0xd1

Found by Linux Verification Center (linuxtesting.org) with Syzkaller.

Fixes: 2f785402f3 ("[JFFS2] Reduce visibility of raw_node_ref to upper layers of JFFS2 code.")
Fixes: f560928baa ("[JFFS2] Allocate node_ref for wasted space when skipping to page boundary")
Cc: stable@vger.kernel.org
Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-06-27 11:11:37 +01:00
arch LoongArch: Fix panic caused by NULL-PMD in huge_pte_offset() 2025-06-27 11:11:37 +01:00
block block: Clear BIO_EMULATES_ZONE_APPEND flag on BIO completion 2025-06-27 11:11:19 +01:00
certs sign-file,extract-cert: use pkcs11 provider for OPENSSL MAJOR >= 3 2024-09-20 19:52:48 +03:00
crypto crypto: api - Redo lookup on EEXIST 2025-06-19 15:31:30 +02:00
Documentation regulator: dt-bindings: mt6357: Drop fixed compatible requirement 2025-06-19 15:32:37 +02:00
drivers platform/loongarch: laptop: Add backlight power control support 2025-06-27 11:11:37 +01:00
fs jffs2: check jffs2_prealloc_raw_node_refs() result in few other places 2025-06-27 11:11:37 +01:00
include Revert "mac80211: Dynamically set CoDel parameters per station" 2025-06-27 11:11:33 +01:00
init rust: clean Rust 1.88.0's unnecessary_transmutes lint 2025-05-18 08:24:51 +02:00
io_uring io_uring: fix task leak issue in io_wq_create() 2025-06-27 11:11:36 +01:00
ipc ipc: fix to protect IPCS lookups using RCU 2025-06-27 11:11:22 +01:00
kernel bpf: Use proper type to calculate bpf_raw_tp_null_args.mask index 2025-06-27 11:11:33 +01:00
lib iov_iter: use iov_offset for length calculation in iov_iter_aligned_bvec 2025-06-19 15:32:21 +02:00
LICENSES LICENSES: add 0BSD license text 2024-09-01 20:43:24 -07:00
mm mm/hugetlb: fix huge_pmd_unshare() vs GUP-fast race 2025-06-27 11:11:26 +01:00
net bpf, sockmap: Fix data lost during EAGAIN retries 2025-06-27 11:11:35 +01:00
rust rust: alloc: add missing invariant in Vec::set_len() 2025-06-19 15:32:09 +02:00
samples samples/bpf: Fix compilation failure for samples/bpf on LoongArch Fedora 2025-05-29 11:02:01 +02:00
scripts Make 'cc-option' work correctly for the -Wno-xyzzy pattern 2025-06-27 11:11:27 +01:00
security smack: Revert "smackfs: Added check catlen" 2025-05-29 11:02:48 +02:00
sound ASoC: tegra210_ahub: Add check to of_device_get_match_data() 2025-06-27 11:11:27 +01:00
tools libbpf: Add identical pointer detection to btf_dedup_is_equiv() 2025-06-27 11:11:32 +01:00
usr kbuild: hdrcheck: fix cross build with clang 2025-03-13 13:02:18 +01:00
virt KVM: Add member to struct kvm_gfn_range to indicate private/shared 2025-05-22 14:29:36 +02:00
.clang-format clang-format: Update with v6.11-rc1's for_each macro list 2024-08-02 13:20:31 +02:00
.clippy.toml rust: clean Rust 1.88.0's warning about clippy::disallowed_macros configuration 2025-05-18 08:24:51 +02:00
.cocciconfig
.editorconfig .editorconfig: remove trim_trailing_whitespace option 2024-06-13 16:47:52 +02:00
.get_maintainer.ignore Add Jeff Kirsher to .get_maintainer.ignore 2024-03-08 11:36:54 +00:00
.gitattributes
.gitignore rust: introduce .clippy.toml 2025-03-13 13:01:42 +01:00
.mailmap mailmap: add entry for Thorsten Blum 2024-11-07 14:14:59 -08:00
.rustfmt.toml
COPYING
CREDITS MAINTAINERS: Remove self from DSA entry 2024-11-03 12:52:38 -08:00
Kbuild
Kconfig
MAINTAINERS MAINTAINERS: Update Alexey Makhalov's email address 2025-05-22 14:29:46 +02:00
Makefile Linux 6.12.34 2025-06-19 15:32:38 +02:00
README README: Fix spelling 2024-03-18 03:36:32 -06:00

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 reStructuredText 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.