Skip to content

Commit d013ef2

Browse files
Julian Anastasovdavem330
authored andcommitted
tcp: fix possible socket refcount problem for ipv6
commit 144d56e ("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> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 463dde1 commit d013ef2

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎net/ipv6/tcp_ipv6.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,9 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
403403
tp->mtu_info = ntohl(info);
404404
if (!sock_owned_by_user(sk))
405405
tcp_v6_mtu_reduced(sk);
406-
else
407-
set_bit(TCP_MTU_REDUCED_DEFERRED, &tp->tsq_flags);
406+
else if (!test_and_set_bit(TCP_MTU_REDUCED_DEFERRED,
407+
&tp->tsq_flags))
408+
sock_hold(sk);
408409
goto out;
409410
}
410411

0 commit comments

Comments
 (0)