diff options
author | Aditya Pakki <pakki001@umn.edu> | 2018-12-24 04:42:38 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-12-05 17:27:01 +0300 |
commit | 88b903fedb6d43443a80a7033b17e0424f072ccc (patch) | |
tree | ff90516b54e2f5c7b2a7ae84192b3a11f7bd3d5f | |
parent | 0df349316d149a002a2996e59374d0c75e4b95e2 (diff) | |
download | linux-88b903fedb6d43443a80a7033b17e0424f072ccc.tar.xz |
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 <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>
-rw-r--r-- | net/core/net_namespace.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 087ce1598b74..01bfe28b20a1 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c @@ -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, |