summaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-04-27 15:47:45 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2016-05-02 19:51:14 -0400
commitb3d58eaffb98e1b5bbf2d6756c59398213caba57 (patch)
tree7a2cd473023e7731db7794fc03e427c97e0439cd /fs/namei.c
parent0fb1ea0933153180df666f6694855ddfe9408e4a (diff)
downloadlinux-stable-b3d58eaffb98e1b5bbf2d6756c59398213caba57.tar.gz
linux-stable-b3d58eaffb98e1b5bbf2d6756c59398213caba57.tar.bz2
linux-stable-b3d58eaffb98e1b5bbf2d6756c59398213caba57.zip
atomic_open(): be paranoid about may_open() return value
It should never return positives; however, with Linux S&M crowd involved, no bogosity is impossible. Results would be unpleasant... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 3951cc4f34c5..8d562a7a7e01 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2920,6 +2920,8 @@ static int atomic_open(struct nameidata *nd, struct dentry *dentry,
acc_mode = 0;
}
error = may_open(&file->f_path, acc_mode, open_flag);
+ if (WARN_ON(error > 0))
+ error = -EINVAL;
out:
dput(dentry);
return error;