Skip to content

Commit

Permalink
net/net_namespace: Check the return value of register_pernet_subsys()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Aditya Pakki authored and David S. Miller committed Dec 24, 2018
1 parent 89dfd00 commit 0eb987c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/core/net_namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0eb987c

Please sign in to comment.