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: <4ED7BC57.5070903@parallels.com>
Date:	Thu, 01 Dec 2011 21:41:43 +0400
From:	Pavel Emelyanov <xemul@...allels.com>
To:	Linux Netdev List <netdev@...r.kernel.org>,
	David Miller <davem@...emloft.net>,
	Eric Dumazet <eric.dumazet@...il.com>
Subject: [PATCH 1/2] unix: Reformat proc files creation

This just makes codepaths better prepared for yet another
proc file creation.

Signed-off-by: Pavel Emelyanov <xemul@...allels.com>

---
 net/unix/af_unix.c |   34 +++++++++++++++++++++++++++-------
 1 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 466fbcc..4b83a9c 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -2326,6 +2326,29 @@ static const struct file_operations unix_seq_fops = {
 	.release	= seq_release_net,
 };
 
+static int unix_proc_create(struct net *net)
+{
+	if (!proc_net_fops_create(net, "unix", 0, &unix_seq_fops))
+		goto out;
+
+	return 0;
+out:
+	return -ENOMEM;
+}
+
+static void unix_proc_destroy(struct net *net)
+{
+	proc_net_remove(net, "unix");
+}
+#else
+static inline int unix_proc_create(struct net *net)
+{
+	return 0;
+}
+
+static inline void unix_proc_destroy(struct net *net)
+{
+}
 #endif
 
 static const struct net_proto_family unix_family_ops = {
@@ -2343,13 +2366,10 @@ static int __net_init unix_net_init(struct net *net)
 	if (unix_sysctl_register(net))
 		goto out;
 
-#ifdef CONFIG_PROC_FS
-	if (!proc_net_fops_create(net, "unix", 0, &unix_seq_fops)) {
+	error = unix_proc_create(net);
+	if (error)
 		unix_sysctl_unregister(net);
-		goto out;
-	}
-#endif
-	error = 0;
+
 out:
 	return error;
 }
@@ -2357,7 +2377,7 @@ out:
 static void __net_exit unix_net_exit(struct net *net)
 {
 	unix_sysctl_unregister(net);
-	proc_net_remove(net, "unix");
+	unix_proc_destroy(net);
 }
 
 static struct pernet_operations unix_net_ops = {
-- 
1.5.5.6
--
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