OSDN Git Service

net: ipv6: reset daddr and dport in socket if connect() fails
authorWei Wang <weiwan@google.com>
Fri, 7 Jul 2017 02:04:39 +0000 (20:04 -0600)
committerSubash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Wed, 12 Jul 2017 21:09:29 +0000 (15:09 -0600)
commita0271af20883c5d00bc208ef2adc19e59004ed18
tree53ff33a6acebbb3d27b844e05873b796ea3973f9
parentc4a69905373742f0e5b1a26fdabe5899055aa3db
net: ipv6: reset daddr and dport in socket if connect() fails

In __ip6_datagram_connect(), reset socket->socket_v6_daddr and inet->dport if
error occurs.
In udp_v6_early_demux(), check for socket_state to make sure it is in
TCP_ESTABLISHED state.
Together, it makes sure unconnected UDP socket won't be considered as a
valid candidate for early demux.

v3: add TCP_ESTABLISHED state check in udp_v6_early_demux()
v2: fix compilation error

CRs-Fixed: 2057820
Change-Id: Ifa9c2ddfaa5b51d4082b7b1dd8a5d03b3c290705
Fixes: 5425077d73e0 ("net: ipv6: Add early demux handler for UDP unicast")
Signed-off-by: Wei Wang <weiwan@google.com>
Acked-by: Maciej Żenczykowski <maze@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Git-commit: 85cb73ff9b74785a7fc752875d7f0fe17ca3ea7c
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
[subashab@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
net/ipv6/datagram.c
net/ipv6/udp.c