linux-stable/include
Eric Dumazet db00828250 net: fix __dst_negative_advice() race
commit 92f1655aa2 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: a87cb3e48e ("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-06-16 13:28:52 +02:00
..
acpi
asm-generic asm-generic: qspinlock: fix queued_spin_value_unlocked() implementation 2023-12-20 15:41:22 +01:00
clocksource
crypto crypto: af_alg - Disallow multiple in-flight AIO requests 2024-01-25 14:34:23 -08:00
drm drm: Don't treat 0 as -1 in drm_fixp2int_ceil 2024-03-26 18:22:19 -04:00
dt-bindings clk: imx8mn: Fix incorrect clock defines 2020-03-18 07:17:55 +01:00
keys certs: Add EFI_CERT_X509_GUID support for dbx entries 2021-06-30 08:47:55 -04:00
kvm KVM: arm/arm64: vgic: Use a single IO device per redistributor 2019-08-25 11:02:52 +01:00
linux params: lift param_set_uint_minmax to common code 2024-06-16 13:28:45 +02:00
math-emu
media media: rename VFL_TYPE_GRABBER to _VIDEO 2024-03-26 18:22:22 -04:00
misc
net net: fix __dst_negative_advice() race 2024-06-16 13:28:52 +02:00
pcmcia It's been a relatively busy cycle for docs: 2019-07-09 12:34:26 -07:00
ras
rdma
scsi scsi: core: Introduce the scsi_cmd_to_rq() function 2023-12-08 08:44:28 +01:00
soc soc: fsl: qbman: Add CGR update function 2024-04-13 12:51:27 +02:00
sound ALSA: pcm: Set per-card upper limit of PCM buffer allocations 2023-08-30 16:27:22 +02:00
target
trace ASoC: tracing: Export SND_SOC_DAPM_DIR_OUT to its value 2024-06-16 13:28:39 +02:00
uapi Input: allocate keycode for Display refresh rate toggle 2024-04-13 12:51:39 +02:00
vdso vdso: Remove superfluous #ifdef __KERNEL__ in vdso/datapage.h 2019-06-26 07:28:09 +02:00
video
xen dma-mapping: drop the dev argument to arch_sync_dma_for_* 2023-04-05 11:16:43 +02:00