mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 09:19:51 +00:00
bail out with ELOOP earlier in do_link loop
If we'd passed through 32 trailing symlinks already, there's no sense following the 33rd - we'll bail out anyway. Better bugger off earlier. It *does* change behaviour, after a fashion - if the 33rd happens to be a procfs-style symlink, original code *would* allow it. This one will not. Cry me a river if that hurts you. Please, do. And post a video of that, while you are at it. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
a1e28038df
commit
c99658fe97
1 changed files with 1 additions and 6 deletions
|
@ -1873,7 +1873,7 @@ struct file *do_filp_open(int dfd, const char *pathname,
|
|||
|
||||
do_link:
|
||||
error = -ELOOP;
|
||||
if (flag & O_NOFOLLOW)
|
||||
if ((flag & O_NOFOLLOW) || count++ == 32)
|
||||
goto exit_dput;
|
||||
/*
|
||||
* This is subtle. Instead of calling do_follow_link() we do the
|
||||
|
@ -1915,11 +1915,6 @@ struct file *do_filp_open(int dfd, const char *pathname,
|
|||
__putname(nd.last.name);
|
||||
goto exit;
|
||||
}
|
||||
error = -ELOOP;
|
||||
if (count++==32) {
|
||||
__putname(nd.last.name);
|
||||
goto exit;
|
||||
}
|
||||
filp = do_last(&nd, &path, open_flag, flag, acc_mode, mode,
|
||||
pathname, &is_link);
|
||||
__putname(nd.last.name);
|
||||
|
|
Loading…
Reference in a new issue