netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] TCP: Replace __kfree_skb() with kfree_skb()
@ 2007-01-26  3:37 Masayuki Nakagawa
  2007-01-26  8:28 ` Jarek Poplawski
  0 siblings, 1 reply; 14+ messages in thread
From: Masayuki Nakagawa @ 2007-01-26  3:37 UTC (permalink / raw)
  To: davem, yoshfuji, herbert; +Cc: nakagawa.msy, mhuth, netdev

This patch simply replaces __kfree_skb() in exit path with kfree_skb().
In tcp_rcv_state_process(), generally skbs should be destroyed only when
the ref count is zero.
That is the way things are supposed to be done in the kernel.

This change might reveals a memory leak of skb.
If it happens, it would be because someone doesn't deal with the skb properly.

Signed-off-by: Masayuki Nakagawa <nakagawa.msy@ncos.nec.co.jp>

--- linux-2.6/net/ipv4/tcp_input.c.orig	2007-01-25 07:04:35.000000000 -0800
+++ linux-2.6/net/ipv4/tcp_input.c	2007-01-25 07:05:05.000000000 -0800
@@ -4423,8 +4423,6 @@ int tcp_rcv_state_process(struct sock *s
 			 * in the interest of security over speed unless
 			 * it's still in use.
 			 */
-			kfree_skb(skb);
-			return 0;
 		}
 		goto discard;

@@ -4634,7 +4632,7 @@ int tcp_rcv_state_process(struct sock *s

 	if (!queued) {
 discard:
-		__kfree_skb(skb);
+		kfree_skb(skb);
 	}
 	return 0;
 }

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

end of thread, other threads:[~2007-01-29 10:35 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-26  3:37 [PATCH] TCP: Replace __kfree_skb() with kfree_skb() Masayuki Nakagawa
2007-01-26  8:28 ` Jarek Poplawski
2007-01-26  9:16   ` Herbert Xu
2007-01-26  9:49     ` Jarek Poplawski
2007-01-26  9:52       ` Herbert Xu
2007-01-26 10:18         ` Jarek Poplawski
2007-01-26 10:45           ` Herbert Xu
2007-01-26 10:58             ` David Miller
2007-01-26 11:02             ` Jarek Poplawski
2007-01-26 13:18               ` Jarek Poplawski
2007-01-26 14:05                 ` Jarek Poplawski
2007-01-26 14:19             ` Alexey Kuznetsov
2007-01-29  8:26             ` Jarek Poplawski
2007-01-29 10:38               ` Jarek Poplawski

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).