diff options
| author | Chris Mason <mason@kernel.org> | 2026-10-07 10:34:08 +0000 |
|---|---|---|
| committer | Amir Goldstein <amir73il@gmail.com> | 2026-10-29 13:21:06 +0100 |
| commit | 65bf000962a33ec9d2488e4e1797b6cf630abcbb (patch) | |
| tree | f793053c349d3c076d5b2f91411e2af138ec00e3 /scripts/basic/split-include.c | |
| parent | e34d2ef818e4c7676d8d8e1bf43e6a1ed39efb2a (diff) | |
| download | linux-65bf000962a33ec9d2488e4e1797b6cf630abcbb.tar.gz linux-65bf000962a33ec9d2488e4e1797b6cf630abcbb.zip | |
ovl: take a snapshot of the name for copy up
The copy up of a directory reads a freed dentry name when a lookup
moves the directory at the same time.
A pointer to the name of a dentry is only valid while something stops
a move of the dentry. ovl_do_copy_up() keeps a plain copy of
c->dentry->d_name in c->destname, and ovl_copy_up_start() only keeps
ovl_rename() away. When a lookup finds the same directory under another
name after a change to the lower layer, d_splice_alias() moves the
dentry and frees its external name.
With a delay in ovl_do_copy_up(), a chmod of a lower-only directory with
a 60 byte name raced with a rename of that directory in the lower layer
and a stat of the new name, and KASAN reported a use-after-free in
lookup_noperm_common().
Fix this by using take_dentry_name_snapshot() for c->destname.
Fixes: 829c28be9bb9 ("ovl: use d_splice_alias() in place of d_add() in lookup")
Cc: stable@vger.kernel.org
Signed-off-by: Chris Mason <mason@kernel.org>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Diffstat (limited to 'scripts/basic/split-include.c')
0 files changed, 0 insertions, 0 deletions
