android_kernel_motorola_sm6375/fs/f2fs
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Chao Yu 5624a3c1b1 f2fs: fix to avoid dirent corruption
[ Upstream commit 53edb549565f55ccd0bdf43be3d66ce4c2d48b28 ]

As Al reported in link[1]:

f2fs_rename()
...
	if (old_dir != new_dir && !whiteout)
		f2fs_set_link(old_inode, old_dir_entry,
					old_dir_page, new_dir);
	else
		f2fs_put_page(old_dir_page, 0);

You want correct inumber in the ".." link.  And cross-directory
rename does move the source to new parent, even if you'd been asked
to leave a whiteout in the old place.

[1] https://lore.kernel.org/all/20231017055040.GN800259@ZenIV/

With below testcase, it may cause dirent corruption, due to it missed
to call f2fs_set_link() to update ".." link to new directory.
- mkdir -p dir/foo
- renameat2 -w dir/foo bar

[ASSERT] (__chk_dots_dentries:1421)  --> Bad inode number[0x4] for '..', parent parent ino is [0x3]
[FSCK] other corrupted bugs                           [Fail]

Fixes: 7e01e7ad74 ("f2fs: support RENAME_WHITEOUT")
Cc: Jan Kara <[email protected]>
Reported-by: Al Viro <[email protected]>
Signed-off-by: Chao Yu <[email protected]>
Reviewed-by: Jan Kara <[email protected]>
Signed-off-by: Jaegeuk Kim <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
2024-01-25 14:34:27 -08:00
..
acl.c
acl.h
checkpoint.c f2fs: fix to drop all dirty pages during umount() if cp_error is set 2023-05-30 12:44:03 +01:00
data.c f2fs: fix to drop all dirty pages during umount() if cp_error is set 2023-05-30 12:44:03 +01:00
debug.c
dir.c f2fs: reduce the scope of setting fsck tag when de->name_len is zero 2021-09-22 12:26:23 +02:00
extent_cache.c f2fs: let's avoid panic if extent_tree is not created 2023-01-24 07:17:58 +01:00
f2fs.h f2fs: fix to do sanity check on destination blkaddr during recovery 2022-10-26 13:22:17 +02:00
file.c f2fs: fix to initialize map.m_pblk in f2fs_precache_extents() 2023-11-20 10:30:14 +01:00
gc.c f2fs: fix to do sanity check on inode type during garbage collection 2023-11-08 11:23:38 +01:00
gc.h
hash.c
inline.c f2fs: use memcpy_{to,from}_page() where possible 2023-03-11 16:44:08 +01:00
inode.c f2fs: fix to clear dirty inode in f2fs_evict_inode() 2022-06-14 18:11:44 +02:00
Kconfig
Makefile
namei.c f2fs: fix to avoid dirent corruption 2024-01-25 14:34:27 -08:00
node.c f2fs: fix error path handling in truncate_dnode() 2023-07-27 08:37:23 +02:00
node.h
recovery.c f2fs: fix to do sanity check on summary info 2022-10-26 13:22:17 +02:00
segment.c f2fs: fix normal discard process 2023-01-18 11:41:17 +01:00
segment.h f2fs: fix deadloop in foreground GC 2022-06-14 18:11:44 +02:00
shrinker.c
super.c f2fs: use memcpy_{to,from}_page() where possible 2023-03-11 16:44:08 +01:00
sysfs.c f2fs: fix to reserve space for IO align feature 2022-01-27 09:19:53 +01:00
trace.c
trace.h
verity.c fs: f2fs: initialize fsdata in pagecache_write() 2023-03-11 16:44:08 +01:00
xattr.c f2fs: explicitly null-terminate the xattr list 2024-01-25 14:34:19 -08:00
xattr.h