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: <5319A3C2.8080001@cn.fujitsu.com>
Date:	Fri, 07 Mar 2014 18:47:30 +0800
From:	Gu Zheng <guz.fnst@...fujitsu.com>
To:	"David S. Miller" <davem@...emloft.net>
CC:	netdev@...r.kernel.org, linux-kernel <linux-kernel@...r.kernel.org>
Subject: [PATCH] netlink: switch net_ns only if net is not init_net

Many netlink users create netlink sock in the init_net, and the
switching nes_ns(init_net-->net) is needless in this case. So here
we add a pre-check to avoid this.

Signed-off-by: Gu Zheng <guz.fnst@...fujitsu.com>
---
 net/netlink/af_netlink.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index fdf5135..e9e4be9 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -2429,7 +2429,8 @@ __netlink_kernel_create(struct net *net, int unit, struct module *module,
 		goto out_sock_release_nosk;
 
 	sk = sock->sk;
-	sk_change_net(sk, net);
+	if (!net_eq(net, &init_net))
+		sk_change_net(sk, net);
 
 	if (!cfg || cfg->groups < 32)
 		groups = 32;
-- 
1.7.7

--
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