]> git.baikalelectronics.ru Git - kernel.git/commit
net: ipv6: keep sk status consistent after datagram connect failure
authorPaolo Abeni <pabeni@redhat.com>
Mon, 12 Mar 2018 13:54:23 +0000 (14:54 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 12 Mar 2018 19:10:54 +0000 (15:10 -0400)
commitd1ee0f3ef9a66b92d3b4c5dd7cf9a3f0a1951e48
treea74c2098b601e045f05ff0649ecb05e6230b3925
parent316e96ee025d193ef6319b84ebe64de0fd3b2e5c
net: ipv6: keep sk status consistent after datagram connect failure

On unsuccesful ip6_datagram_connect(), if the failure is caused by
ip6_datagram_dst_update(), the sk peer information are cleared, but
the sk->sk_state is preserved.

If the socket was already in an established status, the overall sk
status is inconsistent and fouls later checks in datagram code.

Fix this saving the old peer information and restoring them in
case of failure. This also aligns ipv6 datagram connect() behavior
with ipv4.

v1 -> v2:
 - added missing Fixes tag

Fixes: 7ec1f234b7d1 ("net: ipv6: reset daddr and dport in sk if connect() fails")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/datagram.c