diff options
author | Martin KaFai Lau <martin.lau@kernel.org> | 2023-09-02 02:11:28 +0300 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2023-09-06 12:08:14 +0300 |
commit | 55d49f750b1cb1f177fb1b00ae02cba4613bcfb7 (patch) | |
tree | eb75afa7db2898cb754f4628f9e9d4be5e0b05d8 /kernel/kallsyms_selftest.c | |
parent | a96a44aba556c42b432929d37d60158aca21ad4c (diff) | |
download | linux-55d49f750b1cb1f177fb1b00ae02cba4613bcfb7.tar.xz |
bpf: bpf_sk_storage: Fix the missing uncharge in sk_omem_alloc
The commit c83597fa5dc6 ("bpf: Refactor some inode/task/sk storage functions
for reuse"), refactored the bpf_{sk,task,inode}_storage_free() into
bpf_local_storage_unlink_nolock() which then later renamed to
bpf_local_storage_destroy(). The commit accidentally passed the
"bool uncharge_mem = false" argument to bpf_selem_unlink_storage_nolock()
which then stopped the uncharge from happening to the sk->sk_omem_alloc.
This missing uncharge only happens when the sk is going away (during
__sk_destruct).
This patch fixes it by always passing "uncharge_mem = true". It is a
noop to the task/inode/cgroup storage because they do not have the
map_local_storage_(un)charge enabled in the map_ops. A followup patch
will be done in bpf-next to remove the uncharge_mem argument.
A selftest is added in the next patch.
Fixes: c83597fa5dc6 ("bpf: Refactor some inode/task/sk storage functions for reuse")
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20230901231129.578493-3-martin.lau@linux.dev
Diffstat (limited to 'kernel/kallsyms_selftest.c')
0 files changed, 0 insertions, 0 deletions