linux-next/fs/hfs
Leo Stone b905bafdea
hfs: Sanity check the root record
In the syzbot reproducer, the hfs_cat_rec for the root dir has type
HFS_CDR_FIL after being read with hfs_bnode_read() in hfs_super_fill().
This indicates it should be used as an hfs_cat_file, which is 102 bytes.
Only the first 70 bytes of that struct are initialized, however,
because the entrylength passed into hfs_bnode_read() is still the length of
a directory record. This causes uninitialized values to be used later on,
when the hfs_cat_rec union is treated as the larger hfs_cat_file struct.

Add a check to make sure the retrieved record has the correct type
for the root directory (HFS_CDR_DIR), and make sure we load the correct
number of bytes for a directory record.

Reported-by: syzbot+2db3c7526ba68f4ea776@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=2db3c7526ba68f4ea776
Tested-by: syzbot+2db3c7526ba68f4ea776@syzkaller.appspotmail.com
Tested-by: Leo Stone <leocstone@gmail.com>
Signed-off-by: Leo Stone <leocstone@gmail.com>
Link: https://lore.kernel.org/r/20241201051420.77858-1-leocstone@gmail.com
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-12-02 15:32:19 +01:00
..
attr.c hfs: move hfs_xattr_handlers to .rodata 2023-10-09 16:24:19 +02:00
bfind.c hfs: add lock nesting notation to hfs_find_init 2021-07-15 10:13:49 -07:00
bitmap.c hfs/hfsplus: convert dprint to hfs_dbg 2013-04-30 17:04:05 -07:00
bnode.c hfs: fix missing hfs_bnode_get() in __hfs_bnode_create 2023-02-02 22:50:00 -08:00
brec.c hfs: fix BUG on bnode parent update 2018-10-31 08:54:13 -07:00
btree.c hfs: replace kmap() with kmap_local_page() in btree.c 2022-09-11 21:55:09 -07:00
btree.h hfs: add lock nesting notation to hfs_find_init 2021-07-15 10:13:49 -07:00
catalog.c hfs: convert to new timestamp accessors 2023-10-18 14:08:21 +02:00
dir.c hfs: convert to ctime accessor functions 2023-07-24 10:29:59 +02:00
extent.c fs: Convert aops->write_begin to take a folio 2024-08-07 11:33:21 +02:00
hfs_fs.h fs: Convert aops->write_begin to take a folio 2024-08-07 11:33:21 +02:00
hfs.h address hfs on-disk corruption robustness review comments 2008-02-06 10:41:05 -08:00
inode.c fs: Convert aops->write_begin to take a folio 2024-08-07 11:33:21 +02:00
Kconfig fs: add CONFIG_BUFFER_HEAD 2023-08-02 09:13:09 -06:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
mdb.c block: remove genhd.h 2022-02-02 07:49:59 -07:00
part_tbl.c
string.c get rid of 'parent' argument of ->d_compare() 2016-07-31 16:37:25 -04:00
super.c hfs: Sanity check the root record 2024-12-02 15:32:19 +01:00
sysdep.c hfs: convert to new timestamp accessors 2023-10-18 14:08:21 +02:00
trans.c hfs: Fix OOB Write in hfs_asc2mac 2022-12-11 19:30:19 -08:00