Skip to content

Commit 7e96ec0

Browse files
Xu KuohaiMartin KaFai Lau
authored andcommitted
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: 604326b ("bpf, sockmap: convert to generic sk_msg interface") Signed-off-by: Xu Kuohai <[email protected]> Reviewed-by: John Fastabend <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin KaFai Lau <[email protected]>
1 parent 85c2c79 commit 7e96ec0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

net/core/sock_map.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,13 @@ static void sock_map_del_link(struct sock *sk,
146146
list_for_each_entry_safe(link, tmp, &psock->link, list) {
147147
if (link->link_raw == link_raw) {
148148
struct bpf_map *map = link->map;
149-
struct bpf_stab *stab = container_of(map, struct bpf_stab,
150-
map);
151-
if (psock->saved_data_ready && stab->progs.stream_parser)
149+
struct sk_psock_progs *progs = sock_map_progs(map);
150+
151+
if (psock->saved_data_ready && progs->stream_parser)
152152
strp_stop = true;
153-
if (psock->saved_data_ready && stab->progs.stream_verdict)
153+
if (psock->saved_data_ready && progs->stream_verdict)
154154
verdict_stop = true;
155-
if (psock->saved_data_ready && stab->progs.skb_verdict)
155+
if (psock->saved_data_ready && progs->skb_verdict)
156156
verdict_stop = true;
157157
list_del(&link->list);
158158
sk_psock_free_link(link);

0 commit comments

Comments
 (0)