linux/fs/hfs
Linus Torvalds cb7a95af78 hfs/hfsplus: avoid WARN_ON() for sanity check, use proper error handling
Commit 55d1cbbbb2 ("hfs/hfsplus: use WARN_ON for sanity check") fixed
a build warning by turning a comment into a WARN_ON(), but it turns out
that syzbot then complains because it can trigger said warning with a
corrupted hfs image.

The warning actually does warn about a bad situation, but we are much
better off just handling it as the error it is.  So rather than warn
about us doing bad things, stop doing the bad things and return -EIO.

While at it, also fix a memory leak that was introduced by an earlier
fix for a similar syzbot warning situation, and add a check for one case
that historically wasn't handled at all (ie neither comment nor
subsequent WARN_ON).

Reported-by: syzbot+7bb7cd3595533513a9e7@syzkaller.appspotmail.com
Fixes: 55d1cbbbb2 ("hfs/hfsplus: use WARN_ON for sanity check")
Fixes: 8d824e69d9 ("hfs: fix OOB Read in __hfs_brec_find")
Link: https://lore.kernel.org/lkml/000000000000dbce4e05f170f289@google.com/
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Viacheslav Dubeyko <slava@dubeyko.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2023-01-06 14:09:13 -08:00
..
attr.c acl: handle idmapped mounts 2021-01-24 14:27:17 +01:00
bfind.c hfs: add lock nesting notation to hfs_find_init 2021-07-15 10:13:49 -07:00
bitmap.c
bnode.c hfs: replace kmap() with kmap_local_page() in bnode.c 2022-09-11 21:55:08 -07:00
brec.c
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
dir.c fs: make helpers idmap mount aware 2021-01-24 14:27:20 +01:00
extent.c hfs: Call hfs_write_begin() and generic_write_end() directly 2022-05-08 14:45:56 -04:00
hfs_fs.h hfs: Call hfs_write_begin() and generic_write_end() directly 2022-05-08 14:45:56 -04:00
hfs.h
inode.c hfs/hfsplus: avoid WARN_ON() for sanity check, use proper error handling 2023-01-06 14:09:13 -08:00
Kconfig docs: filesystems: fix renamed references 2020-04-20 15:45:22 -06:00
Makefile
mdb.c block: remove genhd.h 2022-02-02 07:49:59 -07:00
part_tbl.c
string.c
super.c fs: allocate inode by using alloc_inode_sb() 2022-03-22 15:57:03 -07:00
sysdep.c
trans.c hfs: Fix OOB Write in hfs_asc2mac 2022-12-11 19:30:19 -08:00