Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
62fb4a15
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
62fb4a15
编写于
12月 26, 2015
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
don't carry MAY_OPEN in op->acc_mode
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
b40ef869
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
12 addition
and
18 deletion
+12
-18
fs/exec.c
fs/exec.c
+2
-2
fs/namei.c
fs/namei.c
+9
-12
fs/open.c
fs/open.c
+1
-4
未找到文件。
fs/exec.c
浏览文件 @
62fb4a15
...
...
@@ -119,7 +119,7 @@ SYSCALL_DEFINE1(uselib, const char __user *, library)
int
error
=
PTR_ERR
(
tmp
);
static
const
struct
open_flags
uselib_flags
=
{
.
open_flag
=
O_LARGEFILE
|
O_RDONLY
|
__FMODE_EXEC
,
.
acc_mode
=
MAY_READ
|
MAY_EXEC
|
MAY_OPEN
,
.
acc_mode
=
MAY_READ
|
MAY_EXEC
,
.
intent
=
LOOKUP_OPEN
,
.
lookup_flags
=
LOOKUP_FOLLOW
,
};
...
...
@@ -763,7 +763,7 @@ static struct file *do_open_execat(int fd, struct filename *name, int flags)
int
err
;
struct
open_flags
open_exec_flags
=
{
.
open_flag
=
O_LARGEFILE
|
O_RDONLY
|
__FMODE_EXEC
,
.
acc_mode
=
MAY_EXEC
|
MAY_OPEN
,
.
acc_mode
=
MAY_EXEC
,
.
intent
=
LOOKUP_OPEN
,
.
lookup_flags
=
LOOKUP_FOLLOW
,
};
...
...
fs/namei.c
浏览文件 @
62fb4a15
...
...
@@ -2663,10 +2663,6 @@ static int may_open(struct path *path, int acc_mode, int flag)
struct
inode
*
inode
=
dentry
->
d_inode
;
int
error
;
/* O_PATH? */
if
(
!
acc_mode
)
return
0
;
if
(
!
inode
)
return
-
ENOENT
;
...
...
@@ -2688,7 +2684,7 @@ static int may_open(struct path *path, int acc_mode, int flag)
break
;
}
error
=
inode_permission
(
inode
,
acc_mode
);
error
=
inode_permission
(
inode
,
MAY_OPEN
|
acc_mode
);
if
(
error
)
return
error
;
...
...
@@ -2880,7 +2876,7 @@ static int atomic_open(struct nameidata *nd, struct dentry *dentry,
if
(
*
opened
&
FILE_CREATED
)
{
WARN_ON
(
!
(
open_flag
&
O_CREAT
));
fsnotify_create
(
dir
,
dentry
);
acc_mode
=
MAY_OPEN
;
acc_mode
=
0
;
}
error
=
may_open
(
&
file
->
f_path
,
acc_mode
,
open_flag
);
if
(
error
)
...
...
@@ -3093,7 +3089,7 @@ static int do_last(struct nameidata *nd,
/* Don't check for write permission, don't truncate */
open_flag
&=
~
O_TRUNC
;
will_truncate
=
false
;
acc_mode
=
MAY_OPEN
;
acc_mode
=
0
;
path_to_nameidata
(
&
path
,
nd
);
goto
finish_open_created
;
}
...
...
@@ -3177,10 +3173,11 @@ static int do_last(struct nameidata *nd,
got_write
=
true
;
}
finish_open_created:
error
=
may_open
(
&
nd
->
path
,
acc_mode
,
open_flag
);
if
(
error
)
goto
out
;
if
(
likely
(
!
(
open_flag
&
O_PATH
)))
{
error
=
may_open
(
&
nd
->
path
,
acc_mode
,
open_flag
);
if
(
error
)
goto
out
;
}
BUG_ON
(
*
opened
&
FILE_OPENED
);
/* once it's opened, it's opened */
error
=
vfs_open
(
&
nd
->
path
,
file
,
current_cred
());
if
(
!
error
)
{
...
...
@@ -3267,7 +3264,7 @@ static int do_tmpfile(struct nameidata *nd, unsigned flags,
goto
out2
;
audit_inode
(
nd
->
name
,
child
,
0
);
/* Don't check for other permissions, the inode was just created */
error
=
may_open
(
&
path
,
MAY_OPEN
,
op
->
open_flag
);
error
=
may_open
(
&
path
,
0
,
op
->
open_flag
);
if
(
error
)
goto
out2
;
file
->
f_path
.
mnt
=
path
.
mnt
;
...
...
fs/open.c
浏览文件 @
62fb4a15
...
...
@@ -887,7 +887,7 @@ EXPORT_SYMBOL(dentry_open);
static
inline
int
build_open_flags
(
int
flags
,
umode_t
mode
,
struct
open_flags
*
op
)
{
int
lookup_flags
=
0
;
int
acc_mode
;
int
acc_mode
=
ACC_MODE
(
flags
)
;
if
(
flags
&
(
O_CREAT
|
__O_TMPFILE
))
op
->
mode
=
(
mode
&
S_IALLUGO
)
|
S_IFREG
;
...
...
@@ -909,7 +909,6 @@ static inline int build_open_flags(int flags, umode_t mode, struct open_flags *o
if
(
flags
&
__O_TMPFILE
)
{
if
((
flags
&
O_TMPFILE_MASK
)
!=
O_TMPFILE
)
return
-
EINVAL
;
acc_mode
=
MAY_OPEN
|
ACC_MODE
(
flags
);
if
(
!
(
acc_mode
&
MAY_WRITE
))
return
-
EINVAL
;
}
else
if
(
flags
&
O_PATH
)
{
...
...
@@ -919,8 +918,6 @@ static inline int build_open_flags(int flags, umode_t mode, struct open_flags *o
*/
flags
&=
O_DIRECTORY
|
O_NOFOLLOW
|
O_PATH
;
acc_mode
=
0
;
}
else
{
acc_mode
=
MAY_OPEN
|
ACC_MODE
(
flags
);
}
op
->
open_flag
=
flags
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录