atomic_open(): be paranoid about may_open() return value
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 27 Apr 2016 19:47:45 +0000 (15:47 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 2 May 2016 23:51:14 +0000 (19:51 -0400)
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>
fs/namei.c

index 3951cc4f34c556160d414c899fd6fafd72f22d07..8d562a7a7e019ae107195311d11756990ef93d5b 100644 (file)
@@ -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;