[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <516E1F32.6010009@asianux.com>
Date: Wed, 17 Apr 2013 12:04:02 +0800
From: Chen Gang <gang.chen@...anux.com>
To: Eric Paris <eparis@...hat.com>, Al Viro <viro@...iv.linux.org.uk>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: [PATCH v2] kernel: audit_tree: resource management: need put_tree
and goto Err when failure occures
since "normally audit_add_tree_rule() will free it on failure",
need free it completely, when failure occures.
need additional put_tree before return, since get_tree was called.
always need goto error processing area for list_del_init.
Signed-off-by: Chen Gang <gang.chen@...anux.com>
---
kernel/audit_tree.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c
index 642a89c..9dfb0da 100644
--- a/kernel/audit_tree.c
+++ b/kernel/audit_tree.c
@@ -694,13 +694,15 @@ int audit_add_tree_rule(struct audit_krule *rule)
spin_unlock(&hash_lock);
} else {
trim_marked(tree);
+ put_tree(tree);
goto Err;
}
mutex_lock(&audit_filter_mutex);
if (list_empty(&rule->rlist)) {
put_tree(tree);
- return -ENOENT;
+ err = -ENOENT;
+ goto Err1;
}
rule->tree = tree;
put_tree(tree);
@@ -708,6 +710,7 @@ int audit_add_tree_rule(struct audit_krule *rule)
return 0;
Err:
mutex_lock(&audit_filter_mutex);
+Err1:
list_del_init(&tree->list);
list_del_init(&tree->rules);
put_tree(tree);
--
1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists