From: Al Viro Date: Wed, 27 Apr 2016 19:47:45 +0000 (-0400) Subject: atomic_open(): be paranoid about may_open() return value X-Git-Tag: v4.7-rc1~144^2~33 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b3d58eaffb98e1b5bbf2d6756c59398213caba57;p=thirdparty%2Fkernel%2Flinux.git 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 --- diff --git a/fs/namei.c b/fs/namei.c index 3951cc4f34c55..8d562a7a7e019 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;