The sockmap update path already ensures that only full sockets are inserted (see sock_map_sk_state_allowed). Allow BPF to pass pointers to sock_common to map_update_elem(sockmap). This allows calling the helper with struct sock pointer derived from the sockmap iterator context. Signed-off-by: Lorenz Bauer <lmb@xxxxxxxxxxxxxx> --- kernel/bpf/verifier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index f1f45ce42d60..a4c398e05673 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -3895,7 +3895,7 @@ static int resolve_map_arg_type(struct bpf_verifier_env *env, case BPF_MAP_TYPE_SOCKMAP: case BPF_MAP_TYPE_SOCKHASH: if (*arg_type == ARG_PTR_TO_MAP_VALUE) { - *arg_type = ARG_PTR_TO_SOCKET; + *arg_type = ARG_PTR_TO_SOCK_COMMON; } else { verbose(env, "invalid arg_type for sockmap/sockhash\n"); return -EINVAL; -- 2.25.1