Commit 44580a01 authored by John Fastabend's avatar John Fastabend Committed by David S. Miller
Browse files

net: sock_map, fix missing ulp check in sock hash case

sock_map and ULP only work together when ULP is loaded after the sock
map is loaded. In the sock_map case we added a check for this to fail
the load if ULP is already set. However, we missed the check on the
sock_hash side.

Add a ULP check to the sock_hash update path.

Fixes: 604326b4

 ("bpf, sockmap: convert to generic sk_msg interface")
Reported-by: default avatar <>
Signed-off-by: default avatarJohn Fastabend <>
Signed-off-by: default avatarDavid S. Miller <>
parent ebe26aca
......@@ -656,6 +656,7 @@ static int sock_hash_update_common(struct bpf_map *map, void *key,
struct sock *sk, u64 flags)
struct bpf_htab *htab = container_of(map, struct bpf_htab, map);
struct inet_connection_sock *icsk = inet_csk(sk);
u32 key_size = map->key_size, hash;
struct bpf_htab_elem *elem, *elem_new;
struct bpf_htab_bucket *bucket;
......@@ -666,6 +667,8 @@ static int sock_hash_update_common(struct bpf_map *map, void *key,
if (unlikely(flags > BPF_EXIST))
return -EINVAL;
if (unlikely(icsk->icsk_ulp_data))
return -EINVAL;
link = sk_psock_init_link();
if (!link)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment