mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 21:38:32 +08:00
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>
This commit is contained in:
parent
0fb1ea0933
commit
b3d58eaffb
@ -2920,6 +2920,8 @@ static int atomic_open(struct nameidata *nd, struct dentry *dentry,
|
|||||||
acc_mode = 0;
|
acc_mode = 0;
|
||||||
}
|
}
|
||||||
error = may_open(&file->f_path, acc_mode, open_flag);
|
error = may_open(&file->f_path, acc_mode, open_flag);
|
||||||
|
if (WARN_ON(error > 0))
|
||||||
|
error = -EINVAL;
|
||||||
out:
|
out:
|
||||||
dput(dentry);
|
dput(dentry);
|
||||||
return error;
|
return error;
|
||||||
|
Loading…
Reference in New Issue
Block a user