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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1304894407-32201-72-git-send-email-lucian.grijincu@gmail.com>
Date:	Mon,  9 May 2011 00:39:23 +0200
From:	Lucian Adrian Grijincu <lucian.grijincu@...il.com>
To:	linux-kernel@...r.kernel.org
Cc:	netdev@...r.kernel.org,
	Lucian Adrian Grijincu <lucian.grijincu@...il.com>
Subject: [v2 071/115] sysctl: rename (un)use_table to __sysctl_(un)use_header

The former names were not semantically correct, as the use/unuse was
related to the header, not the table. Also this makes it clearer that
sysctl_use_header and __sysctl_use_header are related (one takes the
spin lock inside and the other doesn't).

Signed-off-by: Lucian Adrian Grijincu <lucian.grijincu@...il.com>
---
 kernel/sysctl.c |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index caafbb8..1281827 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1490,16 +1490,16 @@ static struct ctl_table dev_table[] = {
 static DEFINE_SPINLOCK(sysctl_lock);
 
 /* called under sysctl_lock */
-static int use_table(struct ctl_table_header *p)
+static struct ctl_table_header *__sysctl_use_header(struct ctl_table_header *head)
 {
-	if (unlikely(p->unregistering))
-		return 0;
-	p->ctl_use_refs++;
-	return 1;
+	if (unlikely(head->unregistering))
+		return ERR_PTR(-ENOENT);
+	head->ctl_use_refs++;
+	return head;
 }
 
 /* called under sysctl_lock */
-static void unuse_table(struct ctl_table_header *p)
+static void __sysctl_unuse_header(struct ctl_table_header *p)
 {
 	if (!--p->ctl_use_refs)
 		if (unlikely(p->unregistering))
@@ -1511,8 +1511,7 @@ struct ctl_table_header *sysctl_use_header(struct ctl_table_header *head)
 	if (!head)
 		head = &root_table_header;
 	spin_lock(&sysctl_lock);
-	if (!use_table(head))
-		head = ERR_PTR(-ENOENT);
+	head = __sysctl_use_header(head);
 	spin_unlock(&sysctl_lock);
 	return head;
 }
@@ -1522,7 +1521,7 @@ void sysctl_unuse_header(struct ctl_table_header *head)
 	if (!head)
 		return;
 	spin_lock(&sysctl_lock);
-	unuse_table(head);
+	__sysctl_unuse_header(head);
 	spin_unlock(&sysctl_lock);
 }
 
@@ -1600,14 +1599,14 @@ struct ctl_table_header *__sysctl_use_next_header(struct nsproxy *namespaces,
 	if (prev) {
 		head = prev;
 		tmp = &prev->ctl_entry;
-		unuse_table(prev);
+		__sysctl_unuse_header(prev);
 		goto next;
 	}
 	tmp = &root_table_header.ctl_entry;
 	for (;;) {
 		head = list_entry(tmp, struct ctl_table_header, ctl_entry);
 
-		if (!use_table(head))
+		if (IS_ERR(__sysctl_use_header(head)))
 			goto next;
 		spin_unlock(&sysctl_lock);
 		return head;
-- 
1.7.5.134.g1c08b

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ