linux-stable/fs/hfsplus
Dongliang Mu 05103d8848 fs: hfsplus: fix UAF issue in hfsplus_put_super
commit 07db5e247a upstream.

The current hfsplus_put_super first calls hfs_btree_close on
sbi->ext_tree, then invokes iput on sbi->hidden_dir, resulting in an
use-after-free issue in hfsplus_release_folio.

As shown in hfsplus_fill_super, the error handling code also calls iput
before hfs_btree_close.

To fix this error, we move all iput calls before hfsplus_btree_close.

Note that this patch is tested on Syzbot.

Link: https://lkml.kernel.org/r/20230226124948.3175736-1-mudongliangabcd@gmail.com
Reported-by: syzbot+57e3e98f7e3b80f64d56@syzkaller.appspotmail.com
Tested-by: Dongliang Mu <mudongliangabcd@gmail.com>
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
Cc: Bart Van Assche <bvanassche@acm.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Muchun Song <songmuchun@bytedance.com>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-10 09:39:57 +01:00
..
attributes.c
bfind.c
bitmap.c
bnode.c
brec.c
btree.c
catalog.c
dir.c hfsplus: convert to fileattr 2021-04-12 15:04:29 +02:00
extents.c hfsplus: prevent corruption in shrinking truncate 2021-05-14 19:41:32 -07:00
hfsplus_fs.h hfsplus: fix bug causing custom uid and gid being unable to be assigned with mount 2023-01-12 11:58:46 +01:00
hfsplus_raw.h
inode.c hfs/hfsplus: use WARN_ON for sanity check 2023-01-12 11:59:18 +01:00
ioctl.c hfsplus: convert to fileattr 2021-04-12 15:04:29 +02:00
Kconfig
Makefile
options.c hfsplus: fix bug causing custom uid and gid being unable to be assigned with mount 2023-01-12 11:58:46 +01:00
part_tbl.c
super.c fs: hfsplus: fix UAF issue in hfsplus_put_super 2023-03-10 09:39:57 +01:00
tables.c
unicode.c treewide: Remove uninitialized_var() usage 2020-07-16 12:35:15 -07:00
wrapper.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
xattr.c hfsplus: remove unnecessary oom message 2021-07-01 11:06:06 -07:00
xattr.h
xattr_security.c acl: handle idmapped mounts 2021-01-24 14:27:17 +01:00
xattr_trusted.c acl: handle idmapped mounts 2021-01-24 14:27:17 +01:00
xattr_user.c acl: handle idmapped mounts 2021-01-24 14:27:17 +01:00