netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] IPv6/DCCP: Fix memory leak in dccp_v6_do_rcv()
@ 2006-09-29  0:45 Jesper Juhl
  2006-09-29  6:07 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Jesper Juhl @ 2006-09-29  0:45 UTC (permalink / raw)
  To: linux-kernel
  Cc: netdev, dccp, Arnaldo Carvalho de Melo, David S. Miller,
	Pekka Savola, James Morris, Hideaki YOSHIFUJI, Patrick McHardy,
	Alexey Kuznetsov, Jesper Juhl

Coverity found what looks like a real leak in net/dccp/ipv6.c::dccp_v6_do_rcv()

We may leave via the return inside "if (sk->sk_state == DCCP_OPEN) {"
but at that point we may have allocated opt_skb, but we never free it
in that path before the return.


Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
---

 net/dccp/ipv6.c |    2 ++
 1 file changed, 2 insertions(+)

--- linux-2.6.18-git10-orig/net/dccp/ipv6.c	2006-09-28 22:40:07.000000000 +0200
+++ linux-2.6.18-git10/net/dccp/ipv6.c	2006-09-29 02:35:15.000000000 +0200
@@ -997,6 +997,8 @@ static int dccp_v6_do_rcv(struct sock *s
 	if (sk->sk_state == DCCP_OPEN) { /* Fast path */
 		if (dccp_rcv_established(sk, skb, dccp_hdr(skb), skb->len))
 			goto reset;
+		if (opt_skb)
+			__kfree_skb(opt_skb);
 		return 0;
 	}
 





PS. Please keep me on Cc:

-- 
Jesper Juhl <jesper.juhl@gmail.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-09-29 14:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-29  0:45 [PATCH] IPv6/DCCP: Fix memory leak in dccp_v6_do_rcv() Jesper Juhl
2006-09-29  6:07 ` Andrew Morton
2006-09-29 10:02   ` [PATCH] IPv6/DCCP: Remove unused IPV6_PKTOPTIONS code Gerrit Renker
2006-09-29 14:40     ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).