diff options
author | Martin KaFai Lau <martin.lau@kernel.org> | 2023-03-08 09:59:28 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2023-03-10 22:05:28 +0300 |
commit | c0d63f309186d8492577c67c67984c714b6b72bc (patch) | |
tree | 919f1b1a238296e5020be2a9356551225bc6428b /net/core/bpf_sk_storage.c | |
parent | f8ccf30c179ec1ac16654f6e6ceb40cce1530b91 (diff) | |
download | linux-c0d63f309186d8492577c67c67984c714b6b72bc.tar.xz |
bpf: Add bpf_selem_free()
This patch refactors the selem freeing logic into bpf_selem_free().
It is a preparation work for a later patch using
bpf_mem_cache_alloc/free. The other kfree(selem) cases
are also changed to bpf_selem_free(..., reuse_now = true).
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://lore.kernel.org/r/20230308065936.1550103-10-martin.lau@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'net/core/bpf_sk_storage.c')
-rw-r--r-- | net/core/bpf_sk_storage.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/core/bpf_sk_storage.c b/net/core/bpf_sk_storage.c index a5f185b8e50a..24c3dc0d62e5 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(copy_selem, smap, true); atomic_sub(smap->elem_size, &newsk->sk_omem_alloc); bpf_map_put(map); |