linux-stable/fs/hfsplus
Dongliang Mu f348b373ce 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:29:28 +01:00
..
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile hfsplus: drop ACL support 2018-08-22 10:52:50 -07:00
attributes.c hfsplus: fix crash and filesystem corruption when deleting files 2020-04-10 15:36:20 -07:00
bfind.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bitmap.c hfsplus: convert kmap() to kmap_local_page() in bitmap.c 2022-09-11 21:55:04 -07:00
bnode.c hfsplus: convert kmap() to kmap_local_page() in bnode.c 2022-09-11 21:55:04 -07:00
brec.c hfsplus: fix BUG on bnode parent update 2018-10-31 08:54:13 -07:00
btree.c hfsplus: convert kmap() to kmap_local_page() in btree.c 2022-09-11 21:55:05 -07:00
catalog.c hfsplus: prevent btree data loss on ENOSPC 2018-10-31 08:54:13 -07:00
dir.c hfsplus: convert to fileattr 2021-04-12 15:04:29 +02:00
extents.c hfsplus: Call hfsplus_write_begin() and generic_write_end() directly 2022-05-08 14:45:56 -04:00
hfsplus_fs.h hfsplus: fix bug causing custom uid and gid being unable to be assigned with mount 2022-12-11 19:30:20 -08:00
hfsplus_raw.h hfsplus: use struct_group_attr() for memcpy() region 2022-01-20 08:52:54 +02:00
inode.c MM patches for 6.2-rc1. 2022-12-13 19:29:45 -08:00
ioctl.c hfsplus: convert to fileattr 2021-04-12 15:04:29 +02:00
options.c hfsplus: fix bug causing custom uid and gid being unable to be assigned with mount 2022-12-11 19:30:20 -08:00
part_tbl.c fs/hfsplus: Use the enum req_op and blk_opf_t types 2022-07-14 12:14:32 -06:00
super.c fs: hfsplus: fix UAF issue in hfsplus_put_super 2023-03-10 09:29:28 +01:00
tables.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
unicode.c treewide: Remove uninitialized_var() usage 2020-07-16 12:35:15 -07:00
wrapper.c fs/hfsplus: Use the enum req_op and blk_opf_t types 2022-07-14 12:14:32 -06:00
xattr.c hfsplus: use struct_group_attr() for memcpy() region 2022-01-20 08:52:54 +02:00
xattr.h hfsplus: drop ACL support 2018-08-22 10:52:50 -07:00
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