kernel_samsung_a53x/include/net
Eric Dumazet f5d13a708c net: fix __dst_negative_advice() race
commit 92f1655aa2b2294d0b49925f3b875a634bd3b59e upstream.

__dst_negative_advice() does not enforce proper RCU rules when
sk->dst_cache must be cleared, leading to possible UAF.

RCU rules are that we must first clear sk->sk_dst_cache,
then call dst_release(old_dst).

Note that sk_dst_reset(sk) is implementing this protocol correctly,
while __dst_negative_advice() uses the wrong order.

Given that ip6_negative_advice() has special logic
against RTF_CACHE, this means each of the three ->negative_advice()
existing methods must perform the sk_dst_reset() themselves.

Note the check against NULL dst is centralized in
__dst_negative_advice(), there is no need to duplicate
it in various callbacks.

Many thanks to Clement Lecigne for tracking this issue.

This old bug became visible after the blamed commit, using UDP sockets.

Fixes: a87cb3e48ee8 ("net: Facility to report route quality of connected sockets")
Reported-by: Clement Lecigne <clecigne@google.com>
Diagnosed-by: Clement Lecigne <clecigne@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Tom Herbert <tom@herbertland.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://lore.kernel.org/r/20240528114353.1794151-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[Lee: Stable backport]
Signed-off-by: Lee Jones <lee@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-19 12:27:19 +01:00
..
9p Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bluetooth Bluetooth: SCO: Fix not validating setsockopt user input 2024-11-19 11:32:19 +01:00
caif Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
iucv Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
netfilter netfilter: nf_tables: restrict tunnel object to NFPROTO_NETDEV 2024-11-19 12:27:13 +01:00
netns Revert "xfrm: fix a data-race in xfrm_gen_index()" 2024-11-17 19:38:56 +01:00
nfc Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
phonet Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sctp Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tc_act Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
6lowpan.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
act_api.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
addrconf.h ipv6: fix race condition between ipv6_get_ifaddr and ipv6_del_addr 2024-11-19 11:32:19 +01:00
af_ieee802154.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
af_rxrpc.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
af_unix.h af_unix: Suppress false-positive lockdep splat for spin_lock() in __unix_gc(). 2024-11-19 11:32:38 +01:00
af_vsock.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ah.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
arp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
atmclip.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ax25.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ax88796.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bareudp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bond_3ad.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bond_alb.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bond_options.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bonding.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bpf_sk_storage.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
busy_poll.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
calipso.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cfg80211-wext.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cfg80211.h Backport mac80211 patches from linux-6.1.y 2024-06-15 16:29:20 -03:00
cfg802154.h mac802154: fix llsec key resources release in mac802154_llsec_key_del 2024-11-19 09:22:33 +01:00
checksum.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cipso_ipv4.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cls_cgroup.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cnss2.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cnss_nl.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cnss_prealloc.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cnss_utils.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
codel.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
codel_impl.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
codel_qdisc.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
compat.h net/ipv4/ipv6: Replace one-element arraya with flexible-array members 2024-11-19 08:44:49 +01:00
datalink.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dcbevent.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dcbnl.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
devlink.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dropdump.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dsa.h Backport mac80211 patches from linux-6.1.y 2024-06-15 16:29:20 -03:00
dsfield.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dst.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dst_cache.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dst_metadata.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dst_ops.h net: fix __dst_negative_advice() race 2024-11-19 12:27:19 +01:00
erspan.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
esp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
espintcp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ethoc.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
failover.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fib_notifier.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fib_rules.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
firewire.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
flow.h inet: shrink struct flowi_common 2024-11-18 11:43:07 +01:00
flow_dissector.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
flow_offload.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fou.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fq.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fq_impl.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
garp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gen_stats.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
genetlink.h drop_monitor: Require 'CAP_SYS_ADMIN' when joining "events" group 2024-11-18 12:11:46 +01:00
geneve.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gre.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gro_cells.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gtp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gue.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hwbm.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
icmp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ieee80211_radiotap.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ieee802154_netdev.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
if_inet6.h net: ipv6: support reporting otherwise unknown prefix flags in RTM_NEWPREFIX 2024-11-18 12:11:48 +01:00
ife.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ila.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
inet6_connection_sock.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
inet6_hashtables.h net: remove duplicate reuseport_lookup functions 2024-11-19 12:26:55 +01:00
inet_common.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
inet_connection_sock.h tcp: properly terminate timers for kernel sockets 2024-11-19 09:22:44 +01:00
inet_ecn.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
inet_frag.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
inet_hashtables.h net: remove duplicate reuseport_lookup functions 2024-11-19 12:26:55 +01:00
inet_sock.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
inet_timewait_sock.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
inetpeer.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ip.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ip6_checksum.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ip6_fib.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ip6_route.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ip6_tunnel.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ip_fib.h ipv4/fib: send notify when delete source address routes 2024-11-08 11:26:17 +01:00
ip_tunnels.h geneve: fix header validation in geneve[6]_xmit_skb 2024-11-19 11:32:19 +01:00
ip_vs.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ipcomp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ipconfig.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ipv6.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ipv6_frag.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ipv6_stubs.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ipx.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
iw_handler.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
kcm.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
l3mdev.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lag.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lapb.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lib80211.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
llc.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
llc_c_ac.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
llc_c_ev.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
llc_c_st.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
llc_conn.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
llc_if.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
llc_pdu.h llc: Drop support for ETH_P_TR_802_2. 2024-11-18 12:13:00 +01:00
llc_s_ac.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
llc_s_ev.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
llc_s_st.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
llc_sap.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lwtunnel.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mac80211.h Backport mac80211 patches from linux-6.1.y 2024-06-15 16:29:20 -03:00
mac802154.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
macsec.h net: macsec: indicate next pn update when offloading 2024-11-08 11:25:46 +01:00
mip6.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mld.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mpls.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mpls_iptunnel.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mptcp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mrp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ncm.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ncsi.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ndisc.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
neighbour.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
net_failover.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
net_namespace.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
net_ratelimit.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
netevent.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
netlabel.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
netlink.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
netprio_cgroup.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
netrom.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nexthop.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nl802154.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nsh.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
p8022.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
page_pool.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pie.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ping.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pkt_cls.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pkt_sched.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pptp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
protocol.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
psample.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
psnap.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
raw.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rawv6.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
red.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
regulatory.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
request_sock.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rose.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
route.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rpl.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rsi_91x.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rtnetlink.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rtnh.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sch_generic.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
scm.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
secure_seq.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
seg6.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
seg6_hmac.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
seg6_local.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
skb_tracer.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
slhc_vj.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smc.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
snmp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sock.h net: fix __dst_negative_advice() race 2024-11-19 12:27:19 +01:00
sock_reuseport.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Space.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
stp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
strparser.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
switchdev.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tcp.h mptcp: fix lockless access in subflow ULP diag 2024-11-18 22:25:39 +01:00
tcp_states.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
TEST_MAPPING Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timewait_sock.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tipc.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tls.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tls_toe.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
transp_v6.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tso.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tun_proto.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
udp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
udp_tunnel.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
udplite.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
virt_wifi.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vsock_addr.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vxlan.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
wext.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
wimax.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
x25.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
x25device.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xdp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xdp_priv.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xdp_sock.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xdp_sock_drv.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xfrm.h xfrm: Preserve vlan tags for transport mode software GRO 2024-11-19 11:32:45 +01:00
xsk_buff_pool.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00