Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Linux-御风守护者
linux
提交
36c4f1b1
L
linux
项目概览
Linux-御风守护者
/
linux
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
36c4f1b1
编写于
12月 15, 2008
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
clean up audit_rule_{add,del} a bit
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
e048e02c
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
17 addition
and
25 deletion
+17
-25
kernel/auditfilter.c
kernel/auditfilter.c
+17
-25
未找到文件。
kernel/auditfilter.c
浏览文件 @
36c4f1b1
...
...
@@ -1114,12 +1114,16 @@ static void audit_inotify_unregister(struct list_head *in_list)
/* Find an existing audit rule.
* Caller must hold audit_filter_mutex to prevent stale rule data. */
static
struct
audit_entry
*
audit_find_rule
(
struct
audit_entry
*
entry
,
struct
list_head
*
list
)
struct
list_head
*
*
p
)
{
struct
audit_entry
*
e
,
*
found
=
NULL
;
struct
list_head
*
list
;
int
h
;
if
(
entry
->
rule
.
watch
)
{
if
(
entry
->
rule
.
inode_f
)
{
h
=
audit_hash_ino
(
entry
->
rule
.
inode_f
->
val
);
*
p
=
list
=
&
audit_inode_hash
[
h
];
}
else
if
(
entry
->
rule
.
watch
)
{
/* we don't know the inode number, so must walk entire hash */
for
(
h
=
0
;
h
<
AUDIT_INODE_BUCKETS
;
h
++
)
{
list
=
&
audit_inode_hash
[
h
];
...
...
@@ -1130,6 +1134,8 @@ static struct audit_entry *audit_find_rule(struct audit_entry *entry,
}
}
goto
out
;
}
else
{
*
p
=
list
=
&
audit_filter_list
[
entry
->
rule
.
listnr
];
}
list_for_each_entry
(
e
,
list
,
list
)
...
...
@@ -1274,14 +1280,13 @@ static u64 prio_low = ~0ULL/2;
static
u64
prio_high
=
~
0ULL
/
2
-
1
;
/* Add rule to given filterlist if not a duplicate. */
static
inline
int
audit_add_rule
(
struct
audit_entry
*
entry
,
struct
list_head
*
list
)
static
inline
int
audit_add_rule
(
struct
audit_entry
*
entry
)
{
struct
audit_entry
*
e
;
struct
audit_field
*
inode_f
=
entry
->
rule
.
inode_f
;
struct
audit_watch
*
watch
=
entry
->
rule
.
watch
;
struct
audit_tree
*
tree
=
entry
->
rule
.
tree
;
struct
nameidata
*
ndp
=
NULL
,
*
ndw
=
NULL
;
struct
list_head
*
list
;
int
h
,
err
;
#ifdef CONFIG_AUDITSYSCALL
int
dont_count
=
0
;
...
...
@@ -1292,13 +1297,8 @@ static inline int audit_add_rule(struct audit_entry *entry,
dont_count
=
1
;
#endif
if
(
inode_f
)
{
h
=
audit_hash_ino
(
inode_f
->
val
);
list
=
&
audit_inode_hash
[
h
];
}
mutex_lock
(
&
audit_filter_mutex
);
e
=
audit_find_rule
(
entry
,
list
);
e
=
audit_find_rule
(
entry
,
&
list
);
mutex_unlock
(
&
audit_filter_mutex
);
if
(
e
)
{
err
=
-
EEXIST
;
...
...
@@ -1372,15 +1372,14 @@ static inline int audit_add_rule(struct audit_entry *entry,
}
/* Remove an existing rule from filterlist. */
static
inline
int
audit_del_rule
(
struct
audit_entry
*
entry
,
struct
list_head
*
list
)
static
inline
int
audit_del_rule
(
struct
audit_entry
*
entry
)
{
struct
audit_entry
*
e
;
struct
audit_field
*
inode_f
=
entry
->
rule
.
inode_f
;
struct
audit_watch
*
watch
,
*
tmp_watch
=
entry
->
rule
.
watch
;
struct
audit_tree
*
tree
=
entry
->
rule
.
tree
;
struct
list_head
*
list
;
LIST_HEAD
(
inotify_list
);
int
h
,
ret
=
0
;
int
ret
=
0
;
#ifdef CONFIG_AUDITSYSCALL
int
dont_count
=
0
;
...
...
@@ -1390,13 +1389,8 @@ static inline int audit_del_rule(struct audit_entry *entry,
dont_count
=
1
;
#endif
if
(
inode_f
)
{
h
=
audit_hash_ino
(
inode_f
->
val
);
list
=
&
audit_inode_hash
[
h
];
}
mutex_lock
(
&
audit_filter_mutex
);
e
=
audit_find_rule
(
entry
,
list
);
e
=
audit_find_rule
(
entry
,
&
list
);
if
(
!
e
)
{
mutex_unlock
(
&
audit_filter_mutex
);
ret
=
-
ENOENT
;
...
...
@@ -1603,8 +1597,7 @@ int audit_receive_filter(int type, int pid, int uid, int seq, void *data,
if
(
IS_ERR
(
entry
))
return
PTR_ERR
(
entry
);
err
=
audit_add_rule
(
entry
,
&
audit_filter_list
[
entry
->
rule
.
listnr
]);
err
=
audit_add_rule
(
entry
);
audit_log_rule_change
(
loginuid
,
sessionid
,
sid
,
"add"
,
&
entry
->
rule
,
!
err
);
...
...
@@ -1620,8 +1613,7 @@ int audit_receive_filter(int type, int pid, int uid, int seq, void *data,
if
(
IS_ERR
(
entry
))
return
PTR_ERR
(
entry
);
err
=
audit_del_rule
(
entry
,
&
audit_filter_list
[
entry
->
rule
.
listnr
]);
err
=
audit_del_rule
(
entry
);
audit_log_rule_change
(
loginuid
,
sessionid
,
sid
,
"remove"
,
&
entry
->
rule
,
!
err
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录