Skip to content

Commit

Permalink
atomic_open(): be paranoid about may_open() return value
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Al Viro committed May 2, 2016
1 parent 0fb1ea0 commit b3d58ea
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b3d58ea

Please sign in to comment.