All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/net_namespace: Check the return value of register_pernet_subsys()
@ 2018-12-24  1:42 Aditya Pakki
  2018-12-24  9:35 ` Kirill Tkhai
  2018-12-24 22:46 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Aditya Pakki @ 2018-12-24  1:42 UTC (permalink / raw)
  To: pakki001
  Cc: kjlu, David S. Miller, Kirill Tkhai, Andrei Vagin, Tyler Hicks,
	Matthew Wilcox, netdev, linux-kernel

In net_ns_init(), register_pernet_subsys() could fail while registering
network namespace subsystems. The fix checks the return value and
sends a panic() on failure.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
 net/core/net_namespace.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index fefe72774aeb..af8849a7a9c3 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -917,7 +917,8 @@ static int __init net_ns_init(void)
 	init_net_initialized = true;
 	up_write(&pernet_ops_rwsem);
 
-	register_pernet_subsys(&net_ns_ops);
+	if (register_pernet_subsys(&net_ns_ops))
+		panic("Could not register network namespace subsystems");
 
 	rtnl_register(PF_UNSPEC, RTM_NEWNSID, rtnl_net_newid, NULL,
 		      RTNL_FLAG_DOIT_UNLOCKED);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-12-24 22:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-24  1:42 [PATCH] net/net_namespace: Check the return value of register_pernet_subsys() Aditya Pakki
2018-12-24  9:35 ` Kirill Tkhai
2018-12-24 22:46 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.