From: Aditya Pakki Date: Mon, 24 Dec 2018 01:42:38 +0000 (-0600) Subject: net/net_namespace: Check the return value of register_pernet_subsys() X-Git-Tag: v4.9.206~52 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9b852f0a5416c3d2f812413d44fc0166a4c8c419;p=platform%2Fkernel%2Flinux-amlogic.git net/net_namespace: Check the return value of register_pernet_subsys() [ Upstream commit 0eb987c874dc93f9c9d85a6465dbde20fdd3884c ] 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 Reviewed-by: Kirill Tkhai Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 4509dec..7630fa8 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c @@ -802,7 +802,8 @@ static int __init net_ns_init(void) mutex_unlock(&net_mutex); - 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, NULL); rtnl_register(PF_UNSPEC, RTM_GETNSID, rtnl_net_getid, rtnl_net_dumpid,