aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorChen Gang <gang.chen@asianux.com>2013-07-08 18:59:38 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-09 13:33:19 -0400
commit2f992ee85aaa7dfd2bda43efe4493af1e108d054 (patch)
tree607b66c6814020bb9aa7c0ffe1e3d4fd872efbb5 /kernel
parent6beb8a23b50d38a003e80c5f16b50c56e8ae3387 (diff)
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 <gang.chen@asianux.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Eric Paris <eparis@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/auditfilter.c6
1 files changed, 6 insertions, 0 deletions
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)
865 err = audit_add_watch(&entry->rule, &list); 865 err = audit_add_watch(&entry->rule, &list);
866 if (err) { 866 if (err) {
867 mutex_unlock(&audit_filter_mutex); 867 mutex_unlock(&audit_filter_mutex);
868 /*
869 * normally audit_add_tree_rule() will free it
870 * on failure
871 */
872 if (tree)
873 audit_put_tree(tree);
868 goto error; 874 goto error;
869 } 875 }
870 } 876 }