2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00
linux/fs/overlayfs
Amir Goldstein e8bd877fb7 ovl: fix possible double unlink
commit 9d23967b18 ("ovl: simplify an error path in
ovl_copy_up_workdir()") introduced the helper ovl_cleanup_unlocked(),
which is later used in several following patches to re-acquire the parent
inode lock and unlink a dentry that was earlier found using lookup.
This helper was eventually renamed to ovl_cleanup().

The helper ovl_parent_lock() is used to re-acquire the parent inode lock.
After acquiring the parent inode lock, the helper verifies that the
dentry has not since been moved to another parent, but it failed to
verify that the dentry wasn't unlinked from the parent.

This means that now every call to ovl_cleanup() could potentially
race with another thread, unlinking the dentry to be cleaned up
underneath overlayfs and trigger a vfs assertion.

Reported-by: syzbot+ec9fab8b7f0386b98a17@syzkaller.appspotmail.com
Tested-by: syzbot+ec9fab8b7f0386b98a17@syzkaller.appspotmail.com
Fixes: 9d23967b18 ("ovl: simplify an error path in ovl_copy_up_workdir()")
Suggested-by: NeilBrown <neil@brown.name>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
2025-08-18 13:16:49 +02:00
..
copy_up.c vfs-6.17-rc1.fileattr 2025-07-28 15:24:14 -07:00
dir.c ovl: use I_MUTEX_PARENT when locking parent in ovl_create_temp() 2025-08-18 13:16:38 +02:00
export.c VFS: rename lookup_one_len family to lookup_noperm and remove permission check 2025-04-08 11:24:36 +02:00
file.c ovl: remove unneeded non-const conversion 2025-07-18 11:09:33 +02:00
inode.c tree-wide: s/struct fileattr/struct file_kattr/g 2025-07-04 16:14:39 +02:00
Kconfig fs: prepare for stackable filesystems backing file helpers 2023-12-23 16:35:08 +02:00
Makefile ovl: Move xattr support to new xattrs.c file 2023-10-31 00:12:59 +02:00
namei.c vfs-6.17-rc1.ovl 2025-07-28 12:20:06 -07:00
overlayfs.h vfs-6.17-rc1.fileattr 2025-07-28 15:24:14 -07:00
ovl_entry.h ovl: narrow locking in ovl_whiteout() 2025-07-18 11:10:42 +02:00
params.c ovl: narrow locking in ovl_whiteout() 2025-07-18 11:10:42 +02:00
params.h ovl: store and show the user provided lowerdir mount option 2023-10-31 00:13:02 +02:00
readdir.c ovl: rename ovl_cleanup_unlocked() to ovl_cleanup() 2025-07-18 11:10:43 +02:00
super.c vfs-6.17-rc1.ovl 2025-07-28 12:20:06 -07:00
util.c ovl: fix possible double unlink 2025-08-18 13:16:49 +02:00
xattrs.c ovl: use wrapper ovl_revert_creds() 2024-11-11 10:45:04 +01:00