]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: tcp6: fix double call of tcp_v6_fill_cb()
authorAlexey Kodanev <alexey.kodanev@oracle.com>
Fri, 27 Mar 2015 09:24:22 +0000 (12:24 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Apr 2015 08:23:41 +0000 (10:23 +0200)
commit1d069b5a314de8f2c9e598ca0794e358da84f223
tree685a4e3d004de100d93bf21263b61b5e74bc0335
parent6e24551ff94701e62c13c982eca0bc3a682817ad
net: tcp6: fix double call of tcp_v6_fill_cb()

[ Upstream commit 4ad19de8774e2a7b075b3e8ea48db85adcf33fa6 ]

tcp_v6_fill_cb() will be called twice if socket's state changes from
TCP_TIME_WAIT to TCP_LISTEN. That can result in control buffer data
corruption because in the second tcp_v6_fill_cb() call it's not copying
IP6CB(skb) anymore, but 'seq', 'end_seq', etc., so we can get weird and
unpredictable results. Performance loss of up to 1200% has been observed
in LTP/vxlan03 test.

This can be fixed by copying inet6_skb_parm to the beginning of 'cb'
only if xfrm6_policy_check() and tcp_v6_fill_cb() are going to be
called again.

Fixes: 2dc49d1680b53 ("tcp6: don't move IP6CB before xfrm6_policy_check()")
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv6/tcp_ipv6.c