From: Chen Gang Date: Thu, 23 May 2013 00:36:55 +0000 (+1000) Subject: kernel/auditfilter.c: fix leak in audit_add_rule() error path X-Git-Tag: next-20130527~1^2~258 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=aa3ae25256ad4d3bf7f5ab18a9ed2f15fb5b6681;p=karo-tx-linux.git 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 --- 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; } }