diff options
author | Xin Long <lucien.xin@gmail.com> | 2020-10-29 10:04:55 +0300 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2020-10-31 01:23:33 +0300 |
commit | d26796ae589401d209f63f462d5aee3746f3c51e (patch) | |
tree | 4fc33ace0c7c3ffed5b09d70fa908d4c28adf921 /net/ipv4 | |
parent | 1fb74191988fd1cc340c4b2fdaf4c47d2a7d1d17 (diff) | |
download | linux-d26796ae589401d209f63f462d5aee3746f3c51e.tar.xz |
udp: check udp sock encap_type in __udp_lib_err
There is a chance that __udp4/6_lib_lookup() returns a udp encap
sock in __udp_lib_err(), like the udp encap listening sock may
use the same port as remote encap port, in which case it should
go to __udp4/6_lib_err_encap() for more validation before
processing the icmp packet.
This patch is to check encap_type in __udp_lib_err() for the
further validation for a encap sock.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/udp.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 09f0a23d1a01..ca04a8a35e52 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -702,7 +702,7 @@ int __udp4_lib_err(struct sk_buff *skb, u32 info, struct udp_table *udptable) sk = __udp4_lib_lookup(net, iph->daddr, uh->dest, iph->saddr, uh->source, skb->dev->ifindex, inet_sdif(skb), udptable, NULL); - if (!sk) { + if (!sk || udp_sk(sk)->encap_type) { /* No socket for error: try tunnels before discarding */ sk = ERR_PTR(-ENOENT); if (static_branch_unlikely(&udp_encap_needed_key)) { |