kernel_samsung_a53x/net/xfrm
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
..
espintcp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xfrm_algo.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xfrm_compat.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xfrm_device.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xfrm_hash.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xfrm_hash.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xfrm_inout.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xfrm_input.c xfrm: Preserve vlan tags for transport mode software GRO 2024-11-19 11:32:45 +01:00
xfrm_interface_core.c Revert "xfrm: interface: use DEV_STATS_INC()" 2024-11-17 19:38:50 +01:00
xfrm_ipcomp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xfrm_output.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xfrm_policy.c net: fix __dst_negative_advice() race 2024-11-19 12:27:19 +01:00
xfrm_proc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xfrm_replay.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xfrm_state.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xfrm_sysctl.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xfrm_user.c xfrm: Avoid clang fortify warning in copy_to_user_tmpl() 2024-11-19 09:22:38 +01:00