lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <516790ED.6060202@asianux.com>
Date:	Fri, 12 Apr 2013 12:43:25 +0800
From:	Chen Gang <gang.chen@...anux.com>
To:	Eric Paris <eparis@...hat.com>, Al Viro <viro@...iv.linux.org.uk>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH] 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..3729d49 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;
+		got 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

Powered by Openwall GNU/*/Linux Powered by OpenVZ