kernel/auditfilter.c: need process 'tree' when audit_add_watch() failed in audit_add_rule().
PATCH 1/1 kernel/auditfilter.c: need process 'tree' when audit_add_watch() failed in audit_add_rule().
If both 'tree' and 'watch' are valid, need call audit_put_tree(), just like the upper area has done within function audit_add_rule().
--- kernel/auditfilter.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
kernel/auditfilter.c +6 -0
@@ -952,6 +952,12 @@ static inline int audit_add_rule(struct audit_entry *entry) err =audit_add_watch (&entry->rule, &list);if (err) {mutex_unlock (&audit_filter_mutex); +/* +* normally audit_add_tree_rule() will free it +* on failure +*/ +if (tree) +audit_put_tree (tree); goto error; } }
Signature · 1 line
1.7.7.6
Quoted 16 lines · On Fri, 10 May 2013 18:12:26 +0800 Chen Gang <[email protected]> wrote:
If both 'tree' and 'watch' are valid, need call
audit_put_tree(), just like the upper area has done within functionaudit_add_rule().Signed-off-by Chen Gang <[email protected]>--- kernel/auditfilter.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)kernel/auditfilter.c +0
-0@@ -952,6 +952,12 @@ static inline int audit_add_rule(struct audit_entry *entry) err =audit_add_watch (&entry->rule, &list);if (err) {
kernel/auditfilter.c static inline int audit_add_rule(struct audit_entry *entry) · line 963
Quoted 10 lines
kernel/auditfilter.c +6
-0mutex_unlock (&audit_filter_mutex); +/* +* normally audit_add_tree_rule() will free it +* on failure +*/ +if (tree) +audit_put_tree (tree); goto error; } }
Are you sure? Or is the earlier audit_put_tree(tree) wrong?
Where is the "get" which this "put" is undoing?
Quoted 21 lines · Andrew Morton
Quoted 19 lines · On Fri, 10 May 2013 18:12:26 +0800 Chen Gang <[email protected]> wrote:
Quoted 19 lines
If both 'tree' and 'watch' are valid, need call
audit_put_tree(), just like the upper area has done within functionaudit_add_rule().Signed-off-by Chen Gang <[email protected]>--- kernel/auditfilter.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)kernel/auditfilter.c +2
-0@@ -952,6 +952,12 @@ static inline int audit_add_rule(struct audit_entry *entry) err =audit_add_watch (&entry->rule, &list);if (err) {mutex_unlock (&audit_filter_mutex); +/* +* normally audit_add_tree_rule() will free it
Quoted 9 lines
Quoted 7 lines
kernel/auditfilter.c static inline int audit_add_rule(struct audit_entry *entry) · line 963
Quoted 7 lines
kernel/auditfilter.c +4
-0+* on failure +*/ +if (tree) +audit_put_tree (tree); goto error; } }Are you sure? Or is the earlier
audit_put_tree(tree)wrong?
Yes I am sure.
Since audit_add_tree_rule() will really free it on failure, we have to be sure to free it in another area within audit_add_rule().
Quoted 3 lines
Where is the "get" which this "put" is undoing?
"Allocating tree" is the "get", this "put" will really free the tree.
Thanks.
Signature · 3 lines
Chen Gang Asianux Corporation