Skip to contentSkip to conversation

sock_put() on a TIMEWAIT socket

PATCH In review Nivedita Singhvi 2 participants 2 messages Mar 29, 2004

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sock_put() on a TIMEWAIT socket

Instances of sock_put() being used instead of tcp_tw_put(). This is for the 2.6 tree.

Patch applies to 2.6.4, but should apply cleanly
to later versions as well.

thanks,
Nivedita

net/ipv4/tcp_ipv4.c +6 -3
diff -urN linux-2.6.4/net/ipv4/tcp_ipv4.c linux-2.6.4mc/net/ipv4/tcp_ipv4.c
@@ -1825,12 +1825,15 @@
 	goto discard_it;
 
 do_time_wait:
-	if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb))
-		goto discard_and_relse;
+	if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) {
+		tcp_tw_put((struct tcp_tw_bucket *) sk);
+		goto discard_it;
+	}
 
 	if (skb->len < (th->doff << 2) || tcp_checksum_complete(skb)) {
 		TCP_INC_STATS_BH(TcpInErrs);
-		goto discard_and_relse;
+		tcp_tw_put((struct tcp_tw_bucket *) sk);
+		goto discard_it;
 	}
 	switch (tcp_timewait_state_process((struct tcp_tw_bucket *)sk,
 					   skb, th, skb->len)) {