aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/prog_tests/tcp_hdr_options.c
diff options
context:
space:
mode:
authorJules Irenge <[email protected]>2022-09-07 15:24:20 +0000
committerAlexei Starovoitov <[email protected]>2022-09-07 18:15:18 +0000
commit9fad7fe5b29803584c7f17a2abe6c2936fec6828 (patch)
tree44399153a3ed1c94fb81141e31da24523542807c /tools/testing/selftests/bpf/prog_tests/tcp_hdr_options.c
parentMerge branch 'bpf-core changes for preparation of HID-bpf' (diff)
downloadkernel-9fad7fe5b29803584c7f17a2abe6c2936fec6828.tar.gz
kernel-9fad7fe5b29803584c7f17a2abe6c2936fec6828.zip
bpf: Fix resetting logic for unreferenced kptrs
Sparse reported a warning at bpf_map_free_kptrs() "warning: Using plain integer as NULL pointer" During the process of fixing this warning, it was discovered that the current code erroneously writes to the pointer variable instead of deferencing and writing to the actual kptr. Hence, Sparse tool accidentally helped to uncover this problem. Fix this by doing WRITE_ONCE(*p, 0) instead of WRITE_ONCE(p, 0). Note that the effect of this bug is that unreferenced kptrs will not be cleared during check_and_free_fields. It is not a problem if the clearing is not done during map_free stage, as there is nothing to free for them. Fixes: 14a324f6a67e ("bpf: Wire up freeing of referenced kptr") Signed-off-by: Jules Irenge <[email protected]> Link: https://lore.kernel.org/r/Yxi3pJaK6UDjVJSy@playground Signed-off-by: Alexei Starovoitov <[email protected]>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/tcp_hdr_options.c')
0 files changed, 0 insertions, 0 deletions