From aa3ae25256ad4d3bf7f5ab18a9ed2f15fb5b6681 Mon Sep 17 00:00:00 2001 From: Chen Gang Date: Thu, 23 May 2013 10:36:55 +1000 Subject: [PATCH] kernel/auditfilter.c: fix leak in audit_add_rule() error path If both 'tree' and 'watch' are valid we must call audit_put_tree(), just like the preceding code within audit_add_rule(). Signed-off-by: Chen Gang Cc: Al Viro Cc: Eric Paris Signed-off-by: Andrew Morton --- kernel/auditfilter.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c index 6bd4a90d1991..ea8550fb7585 100644 --- a/kernel/auditfilter.c +++ b/kernel/auditfilter.c @@ -865,6 +865,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; } } -- 2.39.5