Patchwork ipv6-multicast: Fix memory leak in IPv6 multicast.

login
register
mail settings
Submitter Ben Greear
Date Sept. 23, 2011, 11:11 p.m.
Message ID <1316819461-3192-1-git-send-email-greearb@candelatech.com>
Download mbox | patch
Permalink /patch/116195/
State Accepted
Delegated to: David Miller
Headers show

Comments

Ben Greear - Sept. 23, 2011, 11:11 p.m.
From: Ben Greear <greearb@candelatech.com>

If reg_vif_xmit cannot find a routing entry, be sure to
free the skb before returning the error.

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

> From: Ben Greear <greearb@candelatech.com>
> 
> If reg_vif_xmit cannot find a routing entry, be sure to
> free the skb before returning the error.
> 
> Signed-off-by: Ben Greear <greearb@candelatech.com>

Applied.
--
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:27 p.m.
On 09/27/2011 12:34 PM, David Miller wrote:
> From: greearb@candelatech.com
> Date: Fri, 23 Sep 2011 16:11:01 -0700
>
>> From: Ben Greear<greearb@candelatech.com>
>>
>> If reg_vif_xmit cannot find a routing entry, be sure to
>> free the skb before returning the error.
>>
>> Signed-off-by: Ben Greear<greearb@candelatech.com>
>
> Applied.

This one has not made it to 3.0 stable either.

Ben

Patch

diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 82a8099..e9a8df9 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -696,8 +696,10 @@  static netdev_tx_t reg_vif_xmit(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);
 	dev->stats.tx_bytes += skb->len;