netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tcp: fix possible socket refcount problem for ipv6
@ 2012-09-05 20:53 Julian Anastasov
  2012-09-05 20:57 ` Eric Dumazet
  0 siblings, 1 reply; 3+ messages in thread
From: Julian Anastasov @ 2012-09-05 20:53 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

	commit 144d56e91044181ec0ef67aeca91e9a8b5718348
("tcp: fix possible socket refcount problem") is missing
the IPv6 part. As tcp_release_cb is shared by both protocols
we should hold sock reference for the TCP_MTU_REDUCED_DEFERRED
bit.

Signed-off-by: Julian Anastasov <ja@ssi.bg>
---
 net/ipv6/tcp_ipv6.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 09078b9..f3bfb8b 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -403,8 +403,9 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 		tp->mtu_info = ntohl(info);
 		if (!sock_owned_by_user(sk))
 			tcp_v6_mtu_reduced(sk);
-		else
-			set_bit(TCP_MTU_REDUCED_DEFERRED, &tp->tsq_flags);
+		else if (!test_and_set_bit(TCP_MTU_REDUCED_DEFERRED,
+					   &tp->tsq_flags))
+			sock_hold(sk);
 		goto out;
 	}
 
-- 
1.7.3.4

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

* Re: [PATCH] tcp: fix possible socket refcount problem for ipv6
  2012-09-05 20:53 [PATCH] tcp: fix possible socket refcount problem for ipv6 Julian Anastasov
@ 2012-09-05 20:57 ` Eric Dumazet
  2012-09-05 21:16   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2012-09-05 20:57 UTC (permalink / raw)
  To: Julian Anastasov; +Cc: David Miller, netdev

On Wed, 2012-09-05 at 23:53 +0300, Julian Anastasov wrote:
> 	commit 144d56e91044181ec0ef67aeca91e9a8b5718348
> ("tcp: fix possible socket refcount problem") is missing
> the IPv6 part. As tcp_release_cb is shared by both protocols
> we should hold sock reference for the TCP_MTU_REDUCED_DEFERRED
> bit.
> 
> Signed-off-by: Julian Anastasov <ja@ssi.bg>
> ---
>  net/ipv6/tcp_ipv6.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
> index 09078b9..f3bfb8b 100644
> --- a/net/ipv6/tcp_ipv6.c
> +++ b/net/ipv6/tcp_ipv6.c
> @@ -403,8 +403,9 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
>  		tp->mtu_info = ntohl(info);
>  		if (!sock_owned_by_user(sk))
>  			tcp_v6_mtu_reduced(sk);
> -		else
> -			set_bit(TCP_MTU_REDUCED_DEFERRED, &tp->tsq_flags);
> +		else if (!test_and_set_bit(TCP_MTU_REDUCED_DEFERRED,
> +					   &tp->tsq_flags))
> +			sock_hold(sk);
>  		goto out;
>  	}
>  

Thanks !

Acked-by: Eric Dumazet <edumazet@google.com>

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

* Re: [PATCH] tcp: fix possible socket refcount problem for ipv6
  2012-09-05 20:57 ` Eric Dumazet
@ 2012-09-05 21:16   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2012-09-05 21:16 UTC (permalink / raw)
  To: eric.dumazet; +Cc: ja, netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 05 Sep 2012 22:57:00 +0200

> On Wed, 2012-09-05 at 23:53 +0300, Julian Anastasov wrote:
>> 	commit 144d56e91044181ec0ef67aeca91e9a8b5718348
>> ("tcp: fix possible socket refcount problem") is missing
>> the IPv6 part. As tcp_release_cb is shared by both protocols
>> we should hold sock reference for the TCP_MTU_REDUCED_DEFERRED
>> bit.
>> 
>> Signed-off-by: Julian Anastasov <ja@ssi.bg>
 ...
> Acked-by: Eric Dumazet <edumazet@google.com>

Applied, thanks everyone.

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

end of thread, other threads:[~2012-09-05 21:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-05 20:53 [PATCH] tcp: fix possible socket refcount problem for ipv6 Julian Anastasov
2012-09-05 20:57 ` Eric Dumazet
2012-09-05 21:16   ` David Miller

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