android_kernel_msm-6.1_noth.../include
Eric Dumazet bd2bcb81d4 BACKPORT: net: fix __dst_negative_advice() race
__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.

Bug: 343727534
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>
(cherry picked from commit 92f1655aa2b2294d0b49925f3b875a634bd3b59e)
[Lee: Trivial/unrelated conflict - no change to the patch]
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I293734dca1b81fcb712e1de294f51e96a405f7e4
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-06-03 09:08:52 +00:00
..
acpi
asm-generic Merge 6.1.77 into android14-6.1-lts 2024-04-17 08:34:35 +00:00
clocksource
crypto Reapply "Merge tag 'android14-6.1.75_r00' into android14-6.1" 2024-04-02 19:49:12 +00:00
drm Revert "drm/mipi-dsi: Fix detach call without attach" 2024-04-18 11:52:41 +00:00
dt-bindings Reapply "Merge tag 'android14-6.1.75_r00' into android14-6.1" 2024-04-02 19:49:12 +00:00
keys
kunit kunit: add macro to allow conditionally exposing static symbols to tests 2023-11-20 11:52:08 +01:00
kvm Merge 6.1.47 into android14-6.1-lts 2023-09-13 19:35:46 +00:00
linux Merge tag 'android14-6.1.78_r00' into branch android14-6.1 2024-05-30 15:23:39 +00:00
math-emu
media Revert "media: cec: core: add adap_nb_transmit_canceled() callback" 2023-10-12 14:10:23 +00:00
memory
misc
net BACKPORT: net: fix __dst_negative_advice() race 2024-06-03 09:08:52 +00:00
pcmcia
ras
rdma RDMA/core: Fix umem iterator when PAGE_SIZE is greater then HCA pgsz 2023-12-13 18:39:15 +01:00
rv
scsi scsi: sd: Fix system start for ATA devices 2023-12-08 08:51:14 +01:00
soc net: mscc: ocelot: don't keep PTP configuration of all ports in single structure 2023-07-19 16:22:01 +02:00
sound Revert "ASoC: soc-card: Add storage for PCI SSID" 2023-12-12 18:42:07 +00:00
target
trace Reapply "ANDROID: vendor_hooks: Add hook for binder_detect_low_async_space" 2024-05-29 20:51:37 +00:00
uapi Merge tag 'android14-6.1.78_r00' into branch android14-6.1 2024-05-30 15:23:39 +00:00
ufs FROMLIST: scsi: ufs: core: Export symbols for MTK driver module 2023-07-04 09:08:44 +00:00
vdso
video
xen xen: simplify evtchn_do_upcall() call maze 2023-12-08 08:51:20 +01:00