linux/fs/overlayfs
Amir Goldstein 2c3ef4f89c ovl: initialize ovl_copy_up_ctx.destname inside ovl_do_copy_up()
The ->destname member of struct ovl_copy_up_ctx is initialized inside
ovl_copy_up_one() to ->d_name of the overlayfs dentry being copied up
and then it may be overridden by index name inside ovl_do_copy_up().

ovl_inode_lock() in ovl_copy_up_start() and ovl_copy_up() in ovl_rename()
effectively stabilze ->d_name of the overlayfs dentry being copied up,
but ovl_inode_lock() is not held when ->d_name is being read.

It is not a correctness bug, because if ovl_do_copy_up() races with
ovl_rename() and ctx.destname is freed, we will not end up calling
ovl_do_copy_up() with the dead name reference.

The code becomes much easier to understand and to document if the
initialization of c->destname is always done inside ovl_do_copy_up(),
either to the index entry name, or to the overlay dentry ->d_name.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
2023-11-20 16:01:45 +02:00
..
copy_up.c ovl: initialize ovl_copy_up_ctx.destname inside ovl_do_copy_up() 2023-11-20 16:01:45 +02:00
dir.c ovl: Add an alternative type of whiteout 2023-10-31 00:12:59 +02:00
export.c ovl: remove redundant ofs->indexdir member 2023-11-20 09:49:09 +02:00
file.c ovl: add helper ovl_file_modified() 2023-10-31 00:12:55 +02:00
inode.c ovl: Move xattr support to new xattrs.c file 2023-10-31 00:12:59 +02:00
Kconfig ovl: Kconfig: introduce CONFIG_OVERLAY_FS_DEBUG 2023-08-12 19:02:53 +03:00
Makefile ovl: Move xattr support to new xattrs.c file 2023-10-31 00:12:59 +02:00
namei.c ovl: remove redundant ofs->indexdir member 2023-11-20 09:49:09 +02:00
overlayfs.h ovl: Add an alternative type of whiteout 2023-10-31 00:12:59 +02:00
ovl_entry.h ovl: remove redundant ofs->indexdir member 2023-11-20 09:49:09 +02:00
params.c ovl: remove redundant ofs->indexdir member 2023-11-20 09:49:09 +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: remove redundant ofs->indexdir member 2023-11-20 09:49:09 +02:00
super.c ovl: remove redundant ofs->indexdir member 2023-11-20 09:49:09 +02:00
util.c ovl: remove redundant ofs->indexdir member 2023-11-20 09:49:09 +02:00
xattrs.c ovl: Support escaped overlay.* xattrs 2023-10-31 00:12:59 +02:00