linux-yocto/fs/udf
Larshin Sergey a70dcfa8d0 fs: udf: fix OOB read in lengthAllocDescs handling
commit 3bd5e45c2ce30e239d596becd5db720f7eb83c99 upstream.

When parsing Allocation Extent Descriptor, lengthAllocDescs comes from
on-disk data and must be validated against the block size. Crafted or
corrupted images may set lengthAllocDescs so that the total descriptor
length (sizeof(allocExtDesc) + lengthAllocDescs) exceeds the buffer,
leading udf_update_tag() to call crc_itu_t() on out-of-bounds memory and
trigger a KASAN use-after-free read.

BUG: KASAN: use-after-free in crc_itu_t+0x1d5/0x2b0 lib/crc-itu-t.c:60
Read of size 1 at addr ffff888041e7d000 by task syz-executor317/5309

CPU: 0 UID: 0 PID: 5309 Comm: syz-executor317 Not tainted 6.12.0-rc4-syzkaller-00261-g850925a8133c #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
 print_address_description mm/kasan/report.c:377 [inline]
 print_report+0x169/0x550 mm/kasan/report.c:488
 kasan_report+0x143/0x180 mm/kasan/report.c:601
 crc_itu_t+0x1d5/0x2b0 lib/crc-itu-t.c:60
 udf_update_tag+0x70/0x6a0 fs/udf/misc.c:261
 udf_write_aext+0x4d8/0x7b0 fs/udf/inode.c:2179
 extent_trunc+0x2f7/0x4a0 fs/udf/truncate.c:46
 udf_truncate_tail_extent+0x527/0x7e0 fs/udf/truncate.c:106
 udf_release_file+0xc1/0x120 fs/udf/file.c:185
 __fput+0x23f/0x880 fs/file_table.c:431
 task_work_run+0x24f/0x310 kernel/task_work.c:239
 exit_task_work include/linux/task_work.h:43 [inline]
 do_exit+0xa2f/0x28e0 kernel/exit.c:939
 do_group_exit+0x207/0x2c0 kernel/exit.c:1088
 __do_sys_exit_group kernel/exit.c:1099 [inline]
 __se_sys_exit_group kernel/exit.c:1097 [inline]
 __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1097
 x64_sys_call+0x2634/0x2640 arch/x86/include/generated/asm/syscalls_64.h:232
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
 </TASK>

Validate the computed total length against epos->bh->b_size.

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

Reported-by: syzbot+8743fca924afed42f93e@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=8743fca924afed42f93e
Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Larshin Sergey <Sergey.Larshin@kaspersky.com>
Link: https://patch.msgid.link/20250922131358.745579-1-Sergey.Larshin@kaspersky.com
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-10-15 11:58:08 +02:00
..
balloc.c udf: refactor udf_next_aext() to handle error 2024-11-01 01:58:27 +01:00
dir.c fs: udf: Replace GPL 2.0 boilerplate license notice with SPDX identifier 2023-05-30 15:39:13 +02:00
directory.c udf: refactor inode_bmap() to handle error 2024-11-01 01:58:27 +01:00
ecma_167.h
file.c udf: Fix lock ordering in udf_evict_inode() 2024-08-03 08:53:38 +02:00
ialloc.c udf: convert to ctime accessor functions 2023-07-24 10:30:06 +02:00
inode.c fs: udf: fix OOB read in lengthAllocDescs handling 2025-10-15 11:58:08 +02:00
Kconfig fs: add CONFIG_BUFFER_HEAD 2023-08-02 09:13:09 -06:00
lowlevel.c fs: udf: Replace GPL 2.0 boilerplate license notice with SPDX identifier 2023-05-30 15:39:13 +02:00
Makefile
misc.c fs: udf: Replace GPL 2.0 boilerplate license notice with SPDX identifier 2023-05-30 15:39:13 +02:00
namei.c udf: Verify inode link counts before performing rename 2025-01-09 13:31:50 +01:00
osta_udf.h
partition.c udf: refactor inode_bmap() to handle error 2024-11-01 01:58:27 +01:00
super.c udf: Verify partition map count 2025-08-28 16:28:15 +02:00
symlink.c fs: pass the request_mask to generic_fillattr 2023-08-09 08:56:36 +02:00
truncate.c udf: Make sure i_lenExtents is uptodate on inode eviction 2025-05-22 14:12:19 +02:00
udf_i.h
udf_sb.h
udfdecl.h udf: refactor inode_bmap() to handle error 2024-11-01 01:58:27 +01:00
udfend.h
udftime.c udf: udftime: prevent overflow in udf_disk_stamp_to_time() 2024-06-27 13:49:04 +02:00
unicode.c udf: Fix uninitialized array access for some pathnames 2023-06-21 11:53:06 +02:00