Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bpf, test, cgroup: Use sk_{alloc,free} for test cases
BPF test infra has some hacks in place which kzalloc() a socket and perform minimum init via sock_net_set() and sock_init_data(). As a result, the sk's skcd->cgroup is NULL since it didn't go through proper initialization as it would have been the case from sk_alloc(). Rather than re-adding a NULL test in sock_cgroup_ptr() just for this, use sk_{alloc,free}() pair for the test socket. The latter also allows to get rid of the bpf_sk_storage_free() special case. Fixes: 8520e22 ("bpf, cgroups: Fix cgroup v2 fallback on v1/v2 mixed mode") Fixes: b7a1848 ("bpf: add BPF_PROG_TEST_RUN support for flow dissector") Fixes: 2cb494a ("bpf: add tests for direct packet access from CGROUP_SKB") Reported-by: [email protected] Reported-by: [email protected] Signed-off-by: Daniel Borkmann <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Tested-by: [email protected] Tested-by: [email protected] Link: https://lore.kernel.org/bpf/[email protected]
- Loading branch information