ipvs: null check of net->ipvs in lblc(r) shedulers
authorHans Schillstrom <hans.schillstrom@ericsson.com>
Thu, 26 Apr 2012 07:45:34 +0000 (09:45 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 30 Apr 2012 08:40:14 +0000 (10:40 +0200)
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: Hans Schillstrom <hans.schillstrom@ericsson.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
net/netfilter/ipvs/ip_vs_lblc.c
net/netfilter/ipvs/ip_vs_lblcr.c

index 0f16283fd05854fccc68fad349c7f29509926252..caa43704e55ead5f5c6c2287e78c818cacb038e4 100644 (file)
@@ -551,6 +551,9 @@ static int __net_init __ip_vs_lblc_init(struct net *net)
 {
        struct netns_ipvs *ipvs = net_ipvs(net);
 
+       if (!ipvs)
+               return -ENOENT;
+
        if (!net_eq(net, &init_net)) {
                ipvs->lblc_ctl_table = kmemdup(vs_vars_table,
                                                sizeof(vs_vars_table),
index eec797f8cce705a1676caeb3c3078053ddcdf523..548bf37aa29e07ebd53eaa760dbcadf844edfa13 100644 (file)
@@ -745,6 +745,9 @@ static int __net_init __ip_vs_lblcr_init(struct net *net)
 {
        struct netns_ipvs *ipvs = net_ipvs(net);
 
+       if (!ipvs)
+               return -ENOENT;
+
        if (!net_eq(net, &init_net)) {
                ipvs->lblcr_ctl_table = kmemdup(vs_vars_table,
                                                sizeof(vs_vars_table),