On 3/6/23 12:42 AM, Martin KaFai Lau wrote:
diff --git a/net/core/bpf_sk_storage.c b/net/core/bpf_sk_storage.c index 8b0c9e4341eb..4fc078e8e9ca 100644 --- a/net/core/bpf_sk_storage.c +++ b/net/core/bpf_sk_storage.c @@ -197,7 +197,7 @@ int bpf_sk_storage_clone(const struct sock *sk, struct sock *newsk) } else { ret = bpf_local_storage_alloc(newsk, smap, copy_selem, GFP_ATOMIC); if (ret) { - kfree(copy_selem); + bpf_selem_free(selem, smap, true);
noticed there is a bug here, should be copy_selem. will fix.
atomic_sub(smap->elem_size, &newsk->sk_omem_alloc); bpf_map_put(map);