Patchwork ipv6-multicast: Fix memory leak in input path.

login
register
mail settings
Submitter Ben Greear
Date Sept. 27, 2011, 6:58 p.m.
Message ID <1317149897-14932-1-git-send-email-greearb@candelatech.com>
Download mbox | patch
Permalink /patch/116654/
State Accepted
Delegated to: David Miller
Headers show

Comments

Ben Greear - Sept. 27, 2011, 6:58 p.m.
From: Ben Greear <greearb@candelatech.com>

Have to free the skb before returning if we fail
the fib lookup.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 e9a8df9... 86e3cc1... M	net/ipv6/ip6mr.c
 net/ipv6/ip6mr.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
David Miller - Sept. 27, 2011, 7:16 p.m.
From: greearb@candelatech.com
Date: Tue, 27 Sep 2011 11:58:17 -0700

> From: Ben Greear <greearb@candelatech.com>
> 
> Have to free the skb before returning if we fail
> the fib lookup.
> 
> Signed-off-by: Ben Greear <greearb@candelatech.com>

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ben Greear - Sept. 27, 2011, 7:34 p.m.
On 09/27/2011 12:16 PM, David Miller wrote:
> From: greearb@candelatech.com
> Date: Tue, 27 Sep 2011 11:58:17 -0700
>
>> From: Ben Greear<greearb@candelatech.com>
>>
>> Have to free the skb before returning if we fail
>> the fib lookup.
>>
>> Signed-off-by: Ben Greear<greearb@candelatech.com>
>
> Applied, thanks.

Thanks.

This bug was introduced in 2.6.35, I believe, so should probably send
this to stable as well.

Thanks,
Ben

> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Dumazet - Sept. 27, 2011, 8:08 p.m.
Le mardi 27 septembre 2011 à 12:34 -0700, Ben Greear a écrit :
> On 09/27/2011 12:16 PM, David Miller wrote:
> > From: greearb@candelatech.com
> > Date: Tue, 27 Sep 2011 11:58:17 -0700
> >
> >> From: Ben Greear<greearb@candelatech.com>
> >>
> >> Have to free the skb before returning if we fail
> >> the fib lookup.
> >>
> >> Signed-off-by: Ben Greear<greearb@candelatech.com>
> >
> > Applied, thanks.
> 
> Thanks.
> 
> This bug was introduced in 2.6.35, I believe, so should probably send
> this to stable as well.
> 

A good way to handle this is to include in the changelog of the patch
the reference on faulty commit, to ease David and stable teams work.

Commit d1db275dd3f6
(ipv6: ip6mr: support multiple tables)



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ben Greear - Feb. 2, 2012, 5:26 p.m.
On 09/27/2011 12:16 PM, David Miller wrote:
> From: greearb@candelatech.com
> Date: Tue, 27 Sep 2011 11:58:17 -0700
>
>> From: Ben Greear<greearb@candelatech.com>
>>
>> Have to free the skb before returning if we fail
>> the fib lookup.
>>
>> Signed-off-by: Ben Greear<greearb@candelatech.com>
>
> Applied, thanks.

 From what I can tell, this never made it into the 3.0 stable
series.

I know that normally you feed things to stable, but please let me
know if you'd like me to send it to the stable guys instead...

Thanks,
Ben


> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Feb. 4, 2012, 9:49 p.m.
From: Ben Greear <greearb@candelatech.com>
Date: Thu, 02 Feb 2012 09:26:33 -0800

> On 09/27/2011 12:16 PM, David Miller wrote:
>> From: greearb@candelatech.com
>> Date: Tue, 27 Sep 2011 11:58:17 -0700
>>
>>> From: Ben Greear<greearb@candelatech.com>
>>>
>>> Have to free the skb before returning if we fail
>>> the fib lookup.
>>>
>>> Signed-off-by: Ben Greear<greearb@candelatech.com>
>>
>> Applied, thanks.
> 
> From what I can tell, this never made it into the 3.0 stable
> series.
> 
> I know that normally you feed things to stable, but please let me
> know if you'd like me to send it to the stable guys instead...

I'll queue this and the other one up for -stable, thanks.

--
To unsubscribe from this list: send the line "unsubscribe netdev" 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/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index e9a8df9..86e3cc1 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -2053,8 +2053,10 @@  int ip6_mr_input(struct sk_buff *skb)
 	int err;
 
 	err = ip6mr_fib_lookup(net, &fl6, &mrt);
-	if (err < 0)
+	if (err < 0) {
+		kfree_skb(skb);
 		return err;
+	}
 
 	read_lock(&mrt_lock);
 	cache = ip6mr_cache_find(mrt,