Patchwork [3/5] ipvs: null check of net->ipvs in lblc(r) shedulers

login
register
mail settings
Submitter Simon Horman
Date April 27, 2012, 12:53 a.m.
Message ID <1335488039-13471-4-git-send-email-horms@verge.net.au>
Download mbox | patch
Permalink /patch/155351/
State Accepted
Headers show

Comments

Simon Horman - April 27, 2012, 12:53 a.m.
From: Hans Schillstrom <hans.schillstrom@ericsson.com>

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>
Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
 net/netfilter/ipvs/ip_vs_lblc.c  |    3 +++
 net/netfilter/ipvs/ip_vs_lblcr.c |    3 +++
 2 files changed, 6 insertions(+)
Pablo Neira - April 29, 2012, 11:43 p.m.
On Fri, Apr 27, 2012 at 09:53:57AM +0900, Simon Horman wrote:
> From: Hans Schillstrom <hans.schillstrom@ericsson.com>
> 
> 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>
> Julian Anastasov <ja@ssi.bg>

This incomplete tag has slipped through, right?

Looking at the archive, I don't see any comment from Julian on this,
so I'll just remove it from the patch description.

I'll fix this minor nitppick myself. No need to resend. But you'll
have to rebase your tree, sorry.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Simon Horman - April 30, 2012, 6:35 a.m.
On Mon, Apr 30, 2012 at 01:43:01AM +0200, Pablo Neira Ayuso wrote:
> On Fri, Apr 27, 2012 at 09:53:57AM +0900, Simon Horman wrote:
> > From: Hans Schillstrom <hans.schillstrom@ericsson.com>
> > 
> > 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>
> > Julian Anastasov <ja@ssi.bg>
> 
> This incomplete tag has slipped through, right?
> 
> Looking at the archive, I don't see any comment from Julian on this,
> so I'll just remove it from the patch description.
> 
> I'll fix this minor nitppick myself. No need to resend. But you'll
> have to rebase your tree, sorry.

Sorry about that, I thought I had weeded out that problem.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/netfilter/ipvs/ip_vs_lblc.c b/net/netfilter/ipvs/ip_vs_lblc.c
index 0f16283..caa4370 100644
--- a/net/netfilter/ipvs/ip_vs_lblc.c
+++ b/net/netfilter/ipvs/ip_vs_lblc.c
@@ -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),
diff --git a/net/netfilter/ipvs/ip_vs_lblcr.c b/net/netfilter/ipvs/ip_vs_lblcr.c
index eec797f..548bf37 100644
--- a/net/netfilter/ipvs/ip_vs_lblcr.c
+++ b/net/netfilter/ipvs/ip_vs_lblcr.c
@@ -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),