linux/net/ipv6
Ziyang Xuan 436b7cc7ea ipv6/addrconf: fix a potential refcount underflow for idev
[ Upstream commit 06a0716949 ]

Now in addrconf_mod_rs_timer(), reference idev depends on whether
rs_timer is not pending. Then modify rs_timer timeout.

There is a time gap in [1], during which if the pending rs_timer
becomes not pending. It will miss to hold idev, but the rs_timer
is activated. Thus rs_timer callback function addrconf_rs_timer()
will be executed and put idev later without holding idev. A refcount
underflow issue for idev can be caused by this.

	if (!timer_pending(&idev->rs_timer))
		in6_dev_hold(idev);
		  <--------------[1]
	mod_timer(&idev->rs_timer, jiffies + when);

To fix the issue, hold idev if mod_timer() return 0.

Fixes: b7b1bfce0b ("ipv6: split duplicate address detection and router solicitation timer")
Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-07-23 13:49:24 +02:00
..
ila ila: do not generate empty messages in ila_xlat_nl_cmd_get_mapping() 2023-03-17 08:50:23 +01:00
netfilter netfilter: tproxy: fix deadlock due to missing BH disable 2023-03-17 08:50:25 +01:00
addrconf_core.c
addrconf.c ipv6/addrconf: fix a potential refcount underflow for idev 2023-07-23 13:49:24 +02:00
addrlabel.c ipv6: addrlabel: fix infoleak when sending struct ifaddrlblmsg to network 2022-11-07 12:26:15 +00:00
af_inet6.c dccp: Call inet6_destroy_sock() via sk->sk_destruct(). 2023-04-26 14:28:43 +02:00
ah6.c
anycast.c
calipso.c
datagram.c ipv6: Fix datagram socket connection with DSCP. 2023-02-22 12:59:54 +01:00
esp6_offload.c xfrm: Linearize the skb after offloading if needed. 2023-06-28 11:12:29 +02:00
esp6.c
exthdrs_core.c ipv6: Fix out-of-bounds access in ipv6_find_tlv() 2023-05-30 14:03:21 +01:00
exthdrs_offload.c
exthdrs.c ipv6: rpl: Fix Route of Death. 2023-06-14 11:15:20 +02:00
fib6_notifier.c
fib6_rules.c
fou6.c
icmp.c icmp6: Fix null-ptr-deref of ip6_null_entry->rt6i_idev in icmp6_dev(). 2023-07-23 13:49:23 +02:00
inet6_connection_sock.c
inet6_hashtables.c
ioam6_iptunnel.c
ioam6.c
ip6_checksum.c
ip6_fib.c
ip6_flowlabel.c
ip6_gre.c erspan: get the proto with the md version for collect_md 2023-05-24 17:32:44 +01:00
ip6_icmp.c
ip6_input.c netfilter: keep conntrack reference until IPsecv6 policy checks are done 2023-05-11 23:03:18 +09:00
ip6_offload.c
ip6_offload.h
ip6_output.c ipv6: Fix an uninit variable access bug in __ip6_make_skb() 2023-04-13 16:55:22 +02:00
ip6_tunnel.c net: tunnels: annotate lockless accesses to dev->needed_headroom 2023-03-22 13:33:46 +01:00
ip6_udp_tunnel.c
ip6_vti.c
ip6mr.c
ipcomp6.c
ipv6_sockglue.c tcp: Fix data races around icsk->icsk_af_ops. 2022-10-12 17:50:37 -07:00
Kconfig
Makefile
mcast_snoop.c
mcast.c
mip6.c
ndisc.c
netfilter.c
output_core.c
ping.c ping6: Fix send to link-local addresses with VRF. 2023-06-21 16:00:58 +02:00
proc.c
protocol.c
raw.c ipv{4,6}/raw: fix output xfrm lookup wrt protocol 2023-06-05 09:26:16 +02:00
reassembly.c
route.c ipv6: Add lwtunnel encap size of all siblings in nexthop calculation 2023-03-11 13:55:25 +01:00
rpl_iptunnel.c
rpl.c net: rpl: fix rpl header size calculation 2023-04-26 14:28:34 +02:00
seg6_hmac.c
seg6_iptunnel.c
seg6_local.c
seg6.c
sit.c sit: update dev->needed_headroom in ipip6_tunnel_bind_dev() 2023-05-17 11:53:33 +02:00
syncookies.c
sysctl_net_ipv6.c
tcp_ipv6.c net: ipv6: fix skb hash for some RST packets 2023-05-17 11:53:33 +02:00
tcpv6_offload.c
tunnel6.c
udp_impl.h tcp/udp: Call inet6_destroy_sock() in IPv6 sk->sk_destruct(). 2022-10-12 17:50:37 -07:00
udp_offload.c
udp.c udp6: fix udp6_ehashfn() typo 2023-07-23 13:49:23 +02:00
udplite.c udplite: Fix NULL pointer dereference in __sk_mem_raise_allocated(). 2023-05-30 14:03:20 +01:00
xfrm6_input.c xfrm: fix inbound ipv4/udp/esp packets to UDPv6 dualstack sockets 2023-06-28 11:12:28 +02:00
xfrm6_output.c
xfrm6_policy.c xfrm: Fix ignored return value in xfrm6_init() 2022-11-22 07:16:34 +01:00
xfrm6_protocol.c
xfrm6_state.c
xfrm6_tunnel.c