Skip to content

Commit

Permalink
Make sure that make_create_in_sticky() never sees uninitialized value…
Browse files Browse the repository at this point in the history
… 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>
  • Loading branch information
Al Viro committed Dec 10, 2020
1 parent 77573fa commit 1a97d89
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(;;) {
Expand Down

0 comments on commit 1a97d89

Please sign in to comment.