Thread (8 messages) 8 messages, 3 authors, 2020-09-28

Re: [PATCH bpf-next 1/4] bpf: sockmap: enable map_update_elem from bpf_iter

From: Martin KaFai Lau <hidden>
Date: 2020-09-25 21:54:25
Also in: bpf, lkml

On Fri, Sep 25, 2020 at 10:56:27AM +0100, Lorenz Bauer wrote:
[ ... ]
quoted hunk ↗ jump to hunk
diff --git a/net/core/sock_map.c b/net/core/sock_map.c
index e1f05e3fa1d0..497e7df466d4 100644
--- a/net/core/sock_map.c
+++ b/net/core/sock_map.c
@@ -610,6 +610,9 @@ static int sock_map_update_elem(struct bpf_map *map, void *key,
 	struct sock *sk = (struct sock *)value;
 	int ret;
 
+	if (unlikely(!sk))
sk_fullsock(sk) test is also needed.
+		return -EINVAL;
+
 	if (!sock_map_sk_is_suitable(sk))
sk->sk_type is used in sock_map_sk_is_suitable().
sk_type is not in sock_common.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help