[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170622190341.87998-1-tracywwnj@gmail.com>
Date: Thu, 22 Jun 2017 12:03:41 -0700
From: Wei Wang <tracywwnj@...il.com>
To: David Miller <davem@...emloft.net>, netdev@...r.kernel.org
Cc: Maciej Żenczykowski <maze@...gle.com>,
Subash Abhinov Kasiviswanathan <subashab@...eaurora.org>,
Wei Wang <weiwan@...gle.com>
Subject: [PATCH v2 net] udpv6: reset daddr and dport in sk if connect() fails
From: Wei Wang <weiwan@...gle.com>
In __ip6_datagram_connect(), reset sk->sk_v6_daddr and inet->dport if
error occurs so that udp_v6_early_demux() won't consider this socket
as a valid candidate for early demux.
v2: fix compilation error
Signed-off-by: Wei Wang <weiwan@...gle.com>
Acked-by: Maciej Żenczykowski <maze@...gle.com>
---
net/ipv6/datagram.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index e011122ebd43..5c786f5ab961 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -250,8 +250,14 @@ int __ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr,
*/
err = ip6_datagram_dst_update(sk, true);
- if (err)
+ if (err) {
+ /* Reset daddr and dport so that udp_v6_early_demux()
+ * fails to find this socket
+ */
+ memset(&sk->sk_v6_daddr, 0, sizeof(sk->sk_v6_daddr));
+ inet->inet_dport = 0;
goto out;
+ }
sk->sk_state = TCP_ESTABLISHED;
sk_set_txhash(sk);
--
2.13.1.611.g7e3b11ae1-goog
Powered by blists - more mailing lists