]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kernel/auditfilter.c: fix leak in audit_add_rule() error path
authorChen Gang <gang.chen@asianux.com>
Thu, 23 May 2013 00:36:55 +0000 (10:36 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 27 May 2013 06:08:04 +0000 (16:08 +1000)
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>
kernel/auditfilter.c

index 6bd4a90d1991cdf84e5d14fa187af4a3b3f390f9..ea8550fb7585114c7106909154bcaad8ba811d71 100644 (file)
@@ -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;
                }
        }