]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
net/net_namespace: Check the return value of register_pernet_subsys()
authorAditya Pakki <pakki001@umn.edu>
Mon, 24 Dec 2018 01:42:38 +0000 (19:42 -0600)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 17 Jan 2020 17:21:36 +0000 (14:21 -0300)
BugLink: https://bugs.launchpad.net/bugs/1855787
[ 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 <pakki001@umn.edu>
Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
net/core/net_namespace.c

index 0aa9e103f433fc1c677966552b333c5e49c1f6a3..304d5d6b4cd7891a632d626cd0e8712d672a2427 100644 (file)
@@ -884,7 +884,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,
                      RTNL_FLAG_DOIT_UNLOCKED);