Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
1a9d0797
Commit
1a9d0797
authored
Dec 14, 2008
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
audit_update_lsm_rules() misses the audit_inode_hash[] ones
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
57f71a0a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
30 deletions
+47
-30
kernel/auditfilter.c
kernel/auditfilter.c
+47
-30
No files found.
kernel/auditfilter.c
View file @
1a9d0797
...
...
@@ -1778,6 +1778,41 @@ unlock_and_return:
return
result
;
}
static
int
update_lsm_rule
(
struct
audit_entry
*
entry
)
{
struct
audit_entry
*
nentry
;
struct
audit_watch
*
watch
;
struct
audit_tree
*
tree
;
int
err
=
0
;
if
(
!
security_audit_rule_known
(
&
entry
->
rule
))
return
0
;
watch
=
entry
->
rule
.
watch
;
tree
=
entry
->
rule
.
tree
;
nentry
=
audit_dupe_rule
(
&
entry
->
rule
,
watch
);
if
(
IS_ERR
(
nentry
))
{
/* save the first error encountered for the
* return value */
err
=
PTR_ERR
(
nentry
);
audit_panic
(
"error updating LSM filters"
);
if
(
watch
)
list_del
(
&
entry
->
rule
.
rlist
);
list_del_rcu
(
&
entry
->
list
);
}
else
{
if
(
watch
)
{
list_add
(
&
nentry
->
rule
.
rlist
,
&
watch
->
rules
);
list_del
(
&
entry
->
rule
.
rlist
);
}
else
if
(
tree
)
list_replace_init
(
&
entry
->
rule
.
rlist
,
&
nentry
->
rule
.
rlist
);
list_replace_rcu
(
&
entry
->
list
,
&
nentry
->
list
);
}
call_rcu
(
&
entry
->
rcu
,
audit_free_rule_rcu
);
return
err
;
}
/* This function will re-initialize the lsm_rule field of all applicable rules.
* It will traverse the filter lists serarching for rules that contain LSM
* specific filter fields. When such a rule is found, it is copied, the
...
...
@@ -1785,42 +1820,24 @@ unlock_and_return:
* updated rule. */
int
audit_update_lsm_rules
(
void
)
{
struct
audit_entry
*
entry
,
*
n
,
*
nentry
;
struct
audit_watch
*
watch
;
struct
audit_tree
*
tree
;
struct
audit_entry
*
e
,
*
n
;
int
i
,
err
=
0
;
/* audit_filter_mutex synchronizes the writers */
mutex_lock
(
&
audit_filter_mutex
);
for
(
i
=
0
;
i
<
AUDIT_NR_FILTERS
;
i
++
)
{
list_for_each_entry_safe
(
entry
,
n
,
&
audit_filter_list
[
i
],
list
)
{
if
(
!
security_audit_rule_known
(
&
entry
->
rule
))
continue
;
watch
=
entry
->
rule
.
watch
;
tree
=
entry
->
rule
.
tree
;
nentry
=
audit_dupe_rule
(
&
entry
->
rule
,
watch
);
if
(
IS_ERR
(
nentry
))
{
/* save the first error encountered for the
* return value */
if
(
!
err
)
err
=
PTR_ERR
(
nentry
);
audit_panic
(
"error updating LSM filters"
);
if
(
watch
)
list_del
(
&
entry
->
rule
.
rlist
);
list_del_rcu
(
&
entry
->
list
);
}
else
{
if
(
watch
)
{
list_add
(
&
nentry
->
rule
.
rlist
,
&
watch
->
rules
);
list_del
(
&
entry
->
rule
.
rlist
);
}
else
if
(
tree
)
list_replace_init
(
&
entry
->
rule
.
rlist
,
&
nentry
->
rule
.
rlist
);
list_replace_rcu
(
&
entry
->
list
,
&
nentry
->
list
);
}
call_rcu
(
&
entry
->
rcu
,
audit_free_rule_rcu
);
list_for_each_entry_safe
(
e
,
n
,
&
audit_filter_list
[
i
],
list
)
{
int
res
=
update_lsm_rule
(
e
);
if
(
!
err
)
err
=
res
;
}
}
for
(
i
=
0
;
i
<
AUDIT_INODE_BUCKETS
;
i
++
)
{
list_for_each_entry_safe
(
e
,
n
,
&
audit_inode_hash
[
i
],
list
)
{
int
res
=
update_lsm_rule
(
e
);
if
(
!
err
)
err
=
res
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment