android_kernel_sony_sdm845/fs/hfsplus
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Simon Gander ffdfcd878c hfsplus: fix crash and filesystem corruption when deleting files
commit 25efb2ffdf991177e740b2f63e92b4ec7d310a92 upstream.

When removing files containing extended attributes, the hfsplus driver may
remove the wrong entries from the attributes b-tree, causing major
filesystem damage and in some cases even kernel crashes.

To remove a file, all its extended attributes have to be removed as well.
The driver does this by looking up all keys in the attributes b-tree with
the cnid of the file.  Each of these entries then gets deleted using the
key used for searching, which doesn't contain the attribute's name when it
should.  Since the key doesn't contain the name, the deletion routine will
not find the correct entry and instead remove the one in front of it.  If
parent nodes have to be modified, these become corrupt as well.  This
causes invalid links and unsorted entries that not even macOS's fsck_hfs
is able to fix.

To fix this, modify the search key before an entry is deleted from the
attributes b-tree by copying the found entry's key into the search key,
therefore ensuring that the correct entry gets removed from the tree.

Signed-off-by: Simon Gander <simon@tuxera.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Anton Altaparmakov <anton@tuxera.com>
Cc: <stable@vger.kernel.org>
Link: http://lkml.kernel.org/r/20200327155541.1521-1-simon@tuxera.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-24 07:58:59 +02:00
..
acl.h hfsplus: use generic posix ACL infrastructure 2014-01-25 23:58:20 -05:00
attributes.c hfsplus: fix crash and filesystem corruption when deleting files 2020-04-24 07:58:59 +02:00
bfind.c fs/hfsplus: replace if/BUG by BUG_ON 2015-04-17 09:04:05 -04:00
bitmap.c mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros 2016-04-04 10:41:08 -07:00
bnode.c mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros 2016-04-04 10:41:08 -07:00
brec.c hfsplus: fix BUG on bnode parent update 2019-11-28 18:28:46 +01:00
btree.c hfsplus: prevent btree data loss on ENOSPC 2019-11-28 18:28:47 +01:00
catalog.c hfsplus: prevent btree data loss on ENOSPC 2019-11-28 18:28:47 +01:00
dir.c hfsplus: fix NULL dereference in hfsplus_lookup() 2018-09-15 09:42:57 +02:00
extents.c hfsplus: fix return value of hfsplus_get_block() 2019-11-28 18:28:49 +01:00
hfsplus_fs.h hfsplus: prevent btree data loss on ENOSPC 2019-11-28 18:28:47 +01:00
hfsplus_raw.h hfsplus: fix "unused node is not erased" error 2014-06-06 16:08:10 -07:00
inode.c hfsplus: update timestamps on truncate() 2019-11-28 18:28:49 +01:00
ioctl.c fs: Replace CURRENT_TIME_SEC with current_time() for inode timestamps 2016-09-27 21:06:22 -04:00
Kconfig hfsplus: add necessary declarations for POSIX ACLs support 2013-09-11 15:59:00 -07:00
Makefile hfsplus: integrate POSIX ACLs support into driver 2013-09-11 15:59:01 -07:00
options.c fs: create and use seq_show_option for escaping 2015-09-04 16:54:41 -07:00
part_tbl.c hfsplus: use bio op accessors 2016-06-07 13:41:38 -06:00
posix_acl.c hfsplus: Don't clear SGID when inheriting ACLs 2017-07-27 15:08:07 -07:00
super.c hfsplus: don't return 0 when fill_super() failed 2018-09-15 09:42:57 +02:00
tables.c
unicode.c get rid of 'parent' argument of ->d_compare() 2016-07-31 16:37:25 -04:00
wrapper.c hfsplus: use bio op accessors 2016-06-07 13:41:38 -06:00
xattr.c switch xattr_handler->set() to passing dentry and inode separately 2016-05-27 15:39:43 -04:00
xattr.h switch xattr_handler->set() to passing dentry and inode separately 2016-05-27 15:39:43 -04:00
xattr_security.c switch xattr_handler->set() to passing dentry and inode separately 2016-05-27 15:39:43 -04:00
xattr_trusted.c switch xattr_handler->set() to passing dentry and inode separately 2016-05-27 15:39:43 -04:00
xattr_user.c switch xattr_handler->set() to passing dentry and inode separately 2016-05-27 15:39:43 -04:00