android_kernel_samsung_msm8976/fs/ext4
Theodore Ts'o ae2ae2b6c2 ext4: work around deleting a file with i_nlink == 0 safely
[ Upstream commit c7df4a1ecb8579838ec8c56b2bb6a6716e974f37 ]

If the file system is corrupted such that a file's i_links_count is
too small, then it's possible that when unlinking that file, i_nlink
will already be zero.  Previously we were working around this kind of
corruption by forcing i_nlink to one; but we were doing this before
trying to delete the directory entry --- and if the file system is
corrupted enough that ext4_delete_entry() fails, then we exit with
i_nlink elevated, and this causes the orphan inode list handling to be
FUBAR'ed, such that when we unmount the file system, the orphan inode
list can get corrupted.

A better way to fix this is to simply skip trying to call drop_nlink()
if i_nlink is already zero, thus moving the check to the place where
it makes the most sense.

https://bugzilla.kernel.org/show_bug.cgi?id=205433

Link: https://lore.kernel.org/r/20191112032903.8828-1-tytso@mit.edu
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Change-Id: I9a08356694b4ef9823e9c8c417fa4a1a3fab4cdb
2020-02-12 22:53:24 +01:00
..
Kconfig
Makefile Import latest Samsung release 2017-04-18 03:43:52 +02:00
acl.c ext4: Don't clear SGID when inheriting ACLs 2019-07-27 21:44:57 +02:00
acl.h
balloc.c ext4: check for allocation block validity with block group locked 2019-07-27 21:52:56 +02:00
bitmap.c ext4: Replace open coded mdata csum feature to helper function 2019-07-27 22:11:23 +02:00
block_validity.c Import latest Samsung release 2017-04-18 03:43:52 +02:00
dir.c ext4: force revalidation of directory pointer after seekdir(2) 2019-07-27 21:52:03 +02:00
ext4.h ext4: fix punch hole on files with indirect mapping 2019-08-21 03:28:11 +02:00
ext4_extents.h ext4: verify the depth of extent tree in ext4_find_extent() 2019-07-27 21:51:42 +02:00
ext4_jbd2.c Import latest Samsung release 2017-04-18 03:43:52 +02:00
ext4_jbd2.h ext4: fix NULL pointer dereference while journal is aborted 2019-07-27 22:08:53 +02:00
extents.c ext4: Replace open coded mdata csum feature to helper function 2019-07-27 22:11:23 +02:00
extents_status.c
extents_status.h
file.c ext4: fix data corruption caused by unaligned direct AIO 2019-07-27 22:08:54 +02:00
fsync.c
hash.c
ialloc.c ext4: Replace open coded mdata csum feature to helper function 2019-07-27 22:11:23 +02:00
indirect.c ext4: cleanup bh release code in ext4_ind_remove_space() 2019-08-21 03:28:50 +02:00
inline.c ext4: Replace open coded mdata csum feature to helper function 2019-07-27 22:11:23 +02:00
inode.c ext4: fix punch hole on files with indirect mapping 2019-08-21 03:28:11 +02:00
ioctl.c ext4: add mask of ext4 flags to swap 2019-07-27 22:11:25 +02:00
mballoc.c ext4: only look at the bg_flags field if it is valid 2019-07-27 21:52:00 +02:00
mballoc.h
migrate.c ext4: correctly migrate a file with a hole at the beginning 2015-08-03 09:29:43 -07:00
mmp.c ext4: Replace open coded mdata csum feature to helper function 2019-07-27 22:11:23 +02:00
move_extent.c vfs: pull ext4's double-i_mutex-locking into common code 2019-07-27 22:11:21 +02:00
namei.c ext4: work around deleting a file with i_nlink == 0 safely 2020-02-12 22:53:24 +01:00
page-io.c
resize.c ext4: add missing brelse() in add_new_gdb_meta_bg() 2019-08-13 03:29:23 +02:00
super.c ext4: Replace open coded mdata csum feature to helper function 2019-07-27 22:11:23 +02:00
symlink.c
truncate.h
xattr.c ext4: Replace open coded mdata csum feature to helper function 2019-07-27 22:11:23 +02:00
xattr.h ext4: add extra checks to ext4_xattr_block_get() 2019-07-27 21:52:02 +02:00
xattr_security.c
xattr_trusted.c
xattr_user.c