linux-stable/fs/hfs
Linus Torvalds 45917be9f0 hfs/hfsplus: avoid WARN_ON() for sanity check, use proper error handling
[ Upstream commit cb7a95af78 ]

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: Sasha Levin <sashal@kernel.org>
2023-01-12 12:02:35 +01:00
..
Kconfig docs: filesystems: fix renamed references 2020-04-20 15:45:22 -06:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02: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 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: prevent btree data loss on ENOSPC 2018-10-31 08:54:13 -07:00
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.h
hfs_fs.h hfs: Call hfs_write_begin() and generic_write_end() directly 2022-05-08 14:45:56 -04:00
inode.c hfs/hfsplus: avoid WARN_ON() for sanity check, use proper error handling 2023-01-12 12:02:35 +01: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 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-31 13:32:00 +01:00