diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2020-09-19 18:55:58 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2020-12-10 23:33:17 +0100 |
commit | 1a97d899ecbc4b60c8e8f9b41cde443510b5b1bf (patch) | |
tree | b3ca58cd25a8fab06cd0ad67e35346cf52fffbea /fs/namei.c | |
parent | fs: Kill DCACHE_DONTCACHE dentry even if DCACHE_REFERENCED is set (diff) | |
download | linux-1a97d899ecbc4b60c8e8f9b41cde443510b5b1bf.tar.xz linux-1a97d899ecbc4b60c8e8f9b41cde443510b5b1bf.zip |
Make sure that make_create_in_sticky() never sees uninitialized value of dir_mode
make sure nd->dir_mode is always initialized after success exit from
link_path_walk(); in case of empty path it did not happen.
Reported-by: Anant Thazhemadam <anant.thazhemadam@gmail.com>
Tested-by: Anant Thazhemadam <anant.thazhemadam@gmail.com>
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 d4a6dd772303..fc193c684a57 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2114,8 +2114,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(;;) { |