linux-stable/fs/hfs
Linus Torvalds da23752d96 hfs/hfsplus: avoid WARN_ON() for sanity check, use proper error handling
commit cb7a95af78 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-01-18 11:41:59 +01:00
..
attr.c
bfind.c hfs: add lock nesting notation to hfs_find_init 2021-07-31 08:19:38 +02:00
bitmap.c
bnode.c hfs: fix high memory mapping in hfs_bnode_read 2021-07-31 08:19:38 +02:00
brec.c
btree.c hfs: do not free node before using 2018-11-30 14:56:14 -08:00
btree.h hfs: add lock nesting notation to hfs_find_init 2021-07-31 08:19:38 +02:00
catalog.c
dir.c
extent.c
hfs.h
hfs_fs.h
inode.c hfs/hfsplus: avoid WARN_ON() for sanity check, use proper error handling 2023-01-18 11:41:59 +01:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
mdb.c
part_tbl.c
string.c
super.c hfs: add missing clean-up in hfs_fill_super 2021-07-31 08:19:38 +02:00
sysdep.c
trans.c hfs: Fix OOB Write in hfs_asc2mac 2023-01-18 11:40:59 +01:00