diff --git a/fs/namei.c b/fs/namei.c index e99e2a9da0f7..3f02cae7e73f 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2113,8 +2113,10 @@ static int link_path_walk(const char *name, struct nameidata *nd) return PTR_ERR(name); while (*name=='/') name++; - if (!*name) + if (!*name) { + nd->dir_mode = 0; // short-circuit the 'hardening' idiocy return 0; + } /* At this point we know we have a real path component. */ for(;;) {