The patch below does not apply to the 5.10-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <stable@xxxxxxxxxxxxxxx>. To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y git checkout FETCH_HEAD git cherry-pick -x 7e96ec0e6605b69bb21bbf6c0ff9051e656ec2b1 # <resolve conflicts, build, test, etc.> git commit -s git send-email --to '<stable@xxxxxxxxxxxxxxx>' --in-reply-to '2023081237-letdown-passable-ed46@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^.. Possible dependencies: 7e96ec0e6605 ("bpf, sockmap: Fix map type error in sock_map_del_link") a7ba4558e69a ("sock_map: Introduce BPF_SK_SKB_VERDICT") b017055255d6 ("sock_map: Kill sock_map_link_no_progs()") 2004fdbd8a2b ("sock_map: Simplify sock_map_link() a bit") 4675e234b9e1 ("sock_map: Make sock_map_prog_update() static") ae8b8332fbb5 ("sock_map: Rename skb_parser and skb_verdict") 5a685cd94b21 ("skmsg: Get rid of struct sk_psock_parser") 887596095ec2 ("bpf: Clean up sockmap related Kconfigs") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 7e96ec0e6605b69bb21bbf6c0ff9051e656ec2b1 Mon Sep 17 00:00:00 2001 From: Xu Kuohai <xukuohai@xxxxxxxxxx> Date: Fri, 4 Aug 2023 03:37:37 -0400 Subject: [PATCH] bpf, sockmap: Fix map type error in sock_map_del_link sock_map_del_link() operates on both SOCKMAP and SOCKHASH, although both types have member named "progs", the offset of "progs" member in these two types is different, so "progs" should be accessed with the real map type. Fixes: 604326b41a6f ("bpf, sockmap: convert to generic sk_msg interface") Signed-off-by: Xu Kuohai <xukuohai@xxxxxxxxxx> Reviewed-by: John Fastabend <john.fastabend@xxxxxxxxx> Link: https://lore.kernel.org/r/20230804073740.194770-2-xukuohai@xxxxxxxxxxxxxxx Signed-off-by: Martin KaFai Lau <martin.lau@xxxxxxxxxx> diff --git a/net/core/sock_map.c b/net/core/sock_map.c index 08ab108206bf..8f07fea39d9e 100644 --- a/net/core/sock_map.c +++ b/net/core/sock_map.c @@ -146,13 +146,13 @@ static void sock_map_del_link(struct sock *sk, list_for_each_entry_safe(link, tmp, &psock->link, list) { if (link->link_raw == link_raw) { struct bpf_map *map = link->map; - struct bpf_stab *stab = container_of(map, struct bpf_stab, - map); - if (psock->saved_data_ready && stab->progs.stream_parser) + struct sk_psock_progs *progs = sock_map_progs(map); + + if (psock->saved_data_ready && progs->stream_parser) strp_stop = true; - if (psock->saved_data_ready && stab->progs.stream_verdict) + if (psock->saved_data_ready && progs->stream_verdict) verdict_stop = true; - if (psock->saved_data_ready && stab->progs.skb_verdict) + if (psock->saved_data_ready && progs->skb_verdict) verdict_stop = true; list_del(&link->list); sk_psock_free_link(link);