Skip to content

Commit 5b313bc

Browse files
author
Al Viro
committed
teach filename_lookup() to treat NULL filename as ""
Signed-off-by: Al Viro <[email protected]>
1 parent 9852d85 commit 5b313bc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/namei.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,7 @@ struct nameidata {
588588
unsigned seq;
589589
} *stack, internal[EMBEDDED_LEVELS];
590590
struct filename *name;
591+
const char *pathname;
591592
struct nameidata *saved;
592593
unsigned root_seq;
593594
int dfd;
@@ -606,6 +607,7 @@ static void __set_nameidata(struct nameidata *p, int dfd, struct filename *name)
606607
p->depth = 0;
607608
p->dfd = dfd;
608609
p->name = name;
610+
p->pathname = likely(name) ? name->name : "";
609611
p->path.mnt = NULL;
610612
p->path.dentry = NULL;
611613
p->total_link_count = old ? old->total_link_count : 0;
@@ -2439,7 +2441,7 @@ static int link_path_walk(const char *name, struct nameidata *nd)
24392441
static const char *path_init(struct nameidata *nd, unsigned flags)
24402442
{
24412443
int error;
2442-
const char *s = nd->name->name;
2444+
const char *s = nd->pathname;
24432445

24442446
/* LOOKUP_CACHED requires RCU, ask caller to retry */
24452447
if ((flags & (LOOKUP_RCU | LOOKUP_CACHED)) == LOOKUP_CACHED)

0 commit comments

Comments
 (0)