Commit 4b984cd5 authored by Hans Schillstrom's avatar Hans Schillstrom Committed by Pablo Neira Ayuso

ipvs: null check of net->ipvs in lblc(r) shedulers

Avoid crash when registering shedulers after
the IPVS core initialization for netns fails. Do this by
checking for present core (net->ipvs).
Signed-off-by: default avatarHans Schillstrom <hans.schillstrom@ericsson.com>
Acked-by: default avatarJulian Anastasov <ja@ssi.bg>
Signed-off-by: default avatarSimon Horman <horms@verge.net.au>
parent 39f618b4
...@@ -551,6 +551,9 @@ static int __net_init __ip_vs_lblc_init(struct net *net) ...@@ -551,6 +551,9 @@ static int __net_init __ip_vs_lblc_init(struct net *net)
{ {
struct netns_ipvs *ipvs = net_ipvs(net); struct netns_ipvs *ipvs = net_ipvs(net);
if (!ipvs)
return -ENOENT;
if (!net_eq(net, &init_net)) { if (!net_eq(net, &init_net)) {
ipvs->lblc_ctl_table = kmemdup(vs_vars_table, ipvs->lblc_ctl_table = kmemdup(vs_vars_table,
sizeof(vs_vars_table), sizeof(vs_vars_table),
......
...@@ -745,6 +745,9 @@ static int __net_init __ip_vs_lblcr_init(struct net *net) ...@@ -745,6 +745,9 @@ static int __net_init __ip_vs_lblcr_init(struct net *net)
{ {
struct netns_ipvs *ipvs = net_ipvs(net); struct netns_ipvs *ipvs = net_ipvs(net);
if (!ipvs)
return -ENOENT;
if (!net_eq(net, &init_net)) { if (!net_eq(net, &init_net)) {
ipvs->lblcr_ctl_table = kmemdup(vs_vars_table, ipvs->lblcr_ctl_table = kmemdup(vs_vars_table,
sizeof(vs_vars_table), sizeof(vs_vars_table),
......
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