浏览代码

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>
Al Viro 9 年之前
父节点
当前提交
b3d58eaffb
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      fs/namei.c

+ 2 - 0
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;