From: Chen Gang Date: Thu, 27 Jun 2013 23:50:50 +0000 (+1000) Subject: kernel/auditfilter.c: fix leak in audit_add_rule() error path X-Git-Tag: next-20130628~3^2~682 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=363a2f01ebbb619b1fd29ce6acd8df1810c080a5;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 0ee9eff866d6..3d15c66b7f0b 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; } }