TencentOS-kernel/net/ipv6
Linus Lüssing 2b5fbba583 net: bridge: mcast: fix broken length + header check for MRDv6 Adv.
[ Upstream commit 99014088156cd78867d19514a0bc771c4b86b93b ]

The IPv6 Multicast Router Advertisements parsing has the following two
issues:

For one thing, ICMPv6 MRD Advertisements are smaller than ICMPv6 MLD
messages (ICMPv6 MRD Adv.: 8 bytes vs. ICMPv6 MLDv1/2: >= 24 bytes,
assuming MLDv2 Reports with at least one multicast address entry).
When ipv6_mc_check_mld_msg() tries to parse an Multicast Router
Advertisement its MLD length check will fail - and it will wrongly
return -EINVAL, even if we have a valid MRD Advertisement. With the
returned -EINVAL the bridge code will assume a broken packet and will
wrongly discard it, potentially leading to multicast packet loss towards
multicast routers.

The second issue is the MRD header parsing in
br_ip6_multicast_mrd_rcv(): It wrongly checks for an ICMPv6 header
immediately after the IPv6 header (IPv6 next header type). However
according to RFC4286, section 2 all MRD messages contain a Router Alert
option (just like MLD). So instead there is an IPv6 Hop-by-Hop option
for the Router Alert between the IPv6 and ICMPv6 header, again leading
to the bridge wrongly discarding Multicast Router Advertisements.

To fix these two issues, introduce a new return value -ENODATA to
ipv6_mc_check_mld() to indicate a valid ICMPv6 packet with a hop-by-hop
option which is not an MLD but potentially an MRD packet. This also
simplifies further parsing in the bridge code, as ipv6_mc_check_mld()
already fully checks the ICMPv6 header and hop-by-hop option.

These issues were found and fixed with the help of the mrdisc tool
(https://github.com/troglobit/mrdisc).

Fixes: 4b3087c7e37f ("bridge: Snoop Multicast Router Advertisements")
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-05-20 16:08:01 +08:00
..
ila Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
netfilter netfilter: x_tables: fix compat match/target pad out-of-bound write 2021-05-20 16:07:06 +08:00
Kconfig net: ipv6: fix kconfig dependency warning for IPV6_SEG6_HMAC 2021-03-16 16:36:27 +08:00
Makefile Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
addrconf.c ipv6: set multicast flag on the multicast route 2021-04-12 12:51:40 +08:00
addrconf_core.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
addrlabel.c ipv6: addrlabel: fix possible memory leak in ip6addrlbl_net_init 2021-03-16 16:41:51 +08:00
af_inet6.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ah6.c ah6: fix error return code in ah6_input() 2021-03-16 16:41:03 +08:00
anycast.c ipv6: fix memory leaks on IPV6_ADDRFORM path 2021-03-16 16:33:08 +08:00
calipso.c cipso,calipso: resolve a number of problems with the DOI refcounts 2021-04-12 12:52:59 +08:00
datagram.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
esp6.c esp: avoid unneeded kmap_atomic call 2021-04-12 12:51:30 +08:00
esp6_offload.c esp: delete NETIF_F_SCTP_CRC bit from features for esp offload 2021-05-20 16:06:59 +08:00
exthdrs.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
exthdrs_core.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
exthdrs_offload.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
fib6_notifier.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
fib6_rules.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
fou6.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
icmp.c net: icmp: pass zeroed opts from icmp{,v6}_ndo_send before sending 2021-04-12 12:52:42 +08:00
inet6_connection_sock.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
inet6_hashtables.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ip6_checksum.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ip6_fib.c ipv6: fix suspecious RCU usage warning 2021-04-12 12:53:27 +08:00
ip6_flowlabel.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ip6_gre.c net: ip6_gre: set dev->hard_header_len when using header_ops 2021-03-16 16:41:55 +08:00
ip6_icmp.c net: icmp: pass zeroed opts from icmp{,v6}_ndo_send before sending 2021-04-12 12:52:42 +08:00
ip6_input.c ipv6: weaken the v4mapped source check 2021-05-20 16:06:29 +08:00
ip6_offload.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ip6_offload.h Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ip6_output.c net: ipv6: Validate GSO SKB before finish IPv6 processing 2021-04-12 12:51:30 +08:00
ip6_tunnel.c net: ip6_tunnel: Unregister catch-all devices 2021-05-20 16:07:12 +08:00
ip6_udp_tunnel.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ip6_vti.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ip6mr.c net: don't return invalid table id error when we fall back to PF_UNSPEC 2021-03-16 16:28:22 +08:00
ipcomp6.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ipv6_sockglue.c ipv6: fix memory leaks on IPV6_ADDRFORM path 2021-03-16 16:33:08 +08:00
mcast.c mld: fix memory leak in ipv6_mc_destroy_dev() 2021-03-16 16:30:45 +08:00
mcast_snoop.c net: bridge: mcast: fix broken length + header check for MRDv6 Adv. 2021-05-20 16:08:01 +08:00
mip6.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ndisc.c Exempt multicast addresses from five-second neighbor lifetime 2021-03-16 16:41:04 +08:00
netfilter.c netfilter: use actual socket sk rather than skb sk when routing harder 2021-03-16 16:40:35 +08:00
output_core.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ping.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
proc.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
protocol.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
raw.c net-ipv6: bugfix - raw & sctp - switch to ipv6_can_nonlocal_bind() 2021-05-20 16:06:57 +08:00
reassembly.c IPv6: reply ICMP error if the first fragment don't include all headers 2021-04-12 12:51:42 +08:00
route.c net: ipv6: check for validity before dereferencing cfg->fc_nlinfo.nlh 2021-05-20 16:06:55 +08:00
seg6.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
seg6_hmac.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
seg6_iptunnel.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
seg6_local.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
sit.c net: sit: Unregister catch-all devices 2021-05-20 16:07:12 +08:00
syncookies.c net: Update window_clamp if SOCK_RCVBUF is set 2021-03-16 16:40:58 +08:00
sysctl_net_ipv6.c ipv6: Fix sysctl max for fib_multipath_hash_policy 2021-03-16 16:35:46 +08:00
tcp_ipv6.c ipv6: weaken the v4mapped source check 2021-05-20 16:06:29 +08:00
tcpv6_offload.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
tunnel6.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
udp.c udp: Improve load balancing for SO_REUSEPORT. 2021-03-16 16:32:43 +08:00
udp_impl.h Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
udp_offload.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
udplite.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
xfrm6_input.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
xfrm6_output.c xfrm: Always set XFRM_TRANSFORMED in xfrm{4,6}_output_finish 2021-03-16 16:26:53 +08:00
xfrm6_policy.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
xfrm6_protocol.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
xfrm6_state.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
xfrm6_tunnel.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00