Commit bde2b029 authored by Aditya Pakki's avatar Aditya Pakki Committed by Kleber Sacilotto de Souza

net/net_namespace: Check the return value of register_pernet_subsys()

BugLink: https://bugs.launchpad.net/bugs/1855313

[ Upstream commit 0eb987c8 ]

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: default avatarAditya Pakki <pakki001@umn.edu>
Reviewed-by: default avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarConnor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 07dd952d
......@@ -778,7 +778,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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment