Files
linux-stable-mirror/include/net
Michal LuczajandGreg Kroah-Hartman 8926a7ef19 net: Fix TOCTOU issue in sk_is_readable()
[ Upstream commit 2660a544fd ]

sk->sk_prot->sock_is_readable is a valid function pointer when sk resides
in a sockmap. After the last sk_psock_put() (which usually happens when
socket is removed from sockmap), sk->sk_prot gets restored and
sk->sk_prot->sock_is_readable becomes NULL.

This makes sk_is_readable() racy, if the value of sk->sk_prot is reloaded
after the initial check. Which in turn may lead to a null pointer
dereference.

Ensure the function pointer does not turn NULL after the check.

Fixes: 8934ce2fd0 ("bpf: sockmap redirect ingress support")
Suggested-by: Jakub Sitnicki <jakub@cloudflare.com>
Signed-off-by: Michal Luczaj <mhal@rbox.co>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20250609-skisreadable-toctou-v1-1-d0dfb2d62c37@rbox.co
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-06-27 11:07:22 +01:00
..
2025-02-21 13:49:02 +01:00
2024-01-31 16:17:04 -08:00
2025-03-07 16:56:44 +01:00
2024-12-19 18:08:53 +01:00
2025-02-21 13:50:06 +01:00
2023-10-10 22:00:46 +02:00
2023-04-13 16:55:23 +02:00
2023-06-14 11:15:20 +02:00
2025-03-07 16:56:37 +01:00
2025-03-07 16:56:37 +01:00
2024-01-10 17:10:27 +01:00
2023-08-11 12:08:17 +02:00