diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2024-10-20 02:32:39 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2024-10-20 02:32:39 +0200 |
commit | 5b313bcb6e3597dacd893ae9545fd087df46db45 (patch) | |
tree | 125af3ea6fc5aa68f573955e80e07c5c1d80e70b /fs/namei.c | |
parent | Linux 6.12-rc1 (diff) | |
download | linux-5b313bcb6e3597dacd893ae9545fd087df46db45.tar.xz linux-5b313bcb6e3597dacd893ae9545fd087df46db45.zip |
teach filename_lookup() to treat NULL filename as ""
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/namei.c b/fs/namei.c index 4a4a22a08ac2..aaf3cd6c802f 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -588,6 +588,7 @@ struct nameidata { unsigned seq; } *stack, internal[EMBEDDED_LEVELS]; struct filename *name; + const char *pathname; struct nameidata *saved; unsigned root_seq; int dfd; @@ -606,6 +607,7 @@ static void __set_nameidata(struct nameidata *p, int dfd, struct filename *name) p->depth = 0; p->dfd = dfd; p->name = name; + p->pathname = likely(name) ? name->name : ""; p->path.mnt = NULL; p->path.dentry = NULL; p->total_link_count = old ? old->total_link_count : 0; @@ -2439,7 +2441,7 @@ OK: static const char *path_init(struct nameidata *nd, unsigned flags) { int error; - const char *s = nd->name->name; + const char *s = nd->pathname; /* LOOKUP_CACHED requires RCU, ask caller to retry */ if ((flags & (LOOKUP_RCU | LOOKUP_CACHED)) == LOOKUP_CACHED) |