public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: dormando <dormando@rydia.net>
Cc: Cong Wang <xiyou.wangcong@gmail.com>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: BUG: IPv4: Attempt to release TCP socket in state 1
Date: Sun, 17 Mar 2013 12:00:44 -0700	[thread overview]
Message-ID: <1363546844.29475.83.camel@edumazet-glaptop> (raw)
In-Reply-To: <1363539169.29475.78.camel@edumazet-glaptop>

On Sun, 2013-03-17 at 09:52 -0700, Eric Dumazet wrote:

> 
> We perform a sock_hold() somewhere while the socket is already dead.

Oh well, thats not exactly that.

When processing ICMP messages we perform a full inet[6] lookup and can
find a LISTEN socket.

Please try the following fix :

diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index b7ab868..3d250c6 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -407,7 +407,8 @@ void tcp_v4_err(struct sk_buff *icmp_skb, u32 info)
 		if (code > NR_ICMP_UNREACH)
 			goto out;
 
-		if (code == ICMP_FRAG_NEEDED) { /* PMTU discovery (RFC1191) */
+		if (sk->sk_state != TCP_LISTEN &&
+		    code == ICMP_FRAG_NEEDED) { /* PMTU discovery (RFC1191) */
 			tp->mtu_info = info;
 			if (!sock_owned_by_user(sk)) {
 				tcp_v4_mtu_reduced(sk);
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 9b64600..c12b3ff 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -388,7 +388,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 			dst->ops->redirect(dst, sk, skb);
 	}
 
-	if (type == ICMPV6_PKT_TOOBIG) {
+	if (type == ICMPV6_PKT_TOOBIG && sk->sk_state != TCP_LISTEN) {
 		tp->mtu_info = ntohl(info);
 		if (!sock_owned_by_user(sk))
 			tcp_v6_mtu_reduced(sk);

  reply	other threads:[~2013-03-17 19:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <alpine.DEB.2.02.1303041547080.7811@localhost6.localdomain6>
2013-03-05  3:47 ` BUG: IPv4: Attempt to release TCP socket in state 1 Cong Wang
2013-03-05  5:07   ` Eric Dumazet
2013-03-05  5:44     ` dormando
2013-03-05 14:46       ` Eric Dumazet
2013-03-07  0:41         ` dormando
2013-03-07 13:46           ` Eric Dumazet
2013-03-08  7:09             ` dormando
2013-03-14 21:21             ` dormando
2013-03-14 22:56               ` Eric Dumazet
2013-03-14 23:15                 ` dormando
2013-03-14 23:19                   ` Eric Dumazet
2013-03-16 17:36                     ` Eric Dumazet
2013-03-16 17:44                       ` Eric Dumazet
2013-03-16 20:16                         ` dormando
2013-03-17  9:21                         ` dormando
2013-03-17 16:33                           ` Eric Dumazet
2013-03-17 16:52                             ` Eric Dumazet
2013-03-17 19:00                               ` Eric Dumazet [this message]
2013-03-17  6:39                       ` Hannes Frederic Sowa
2013-03-17  7:53                         ` Hannes Frederic Sowa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1363546844.29475.83.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=dormando@rydia.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox