Skip to content
Permalink
Browse files
bpf: fix bpf_cgroup_storage_set() usage in test_run
In bpf_test_run(), check the return value of bpf_cgroup_storage_set()
and do bpf_cgroup_storate_unset() properly.

Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Roman Gushchin <guro@fb.com>
Signed-off-by: Yonghong Song <yhs@fb.com>
  • Loading branch information
yonghong-song authored and intel-lab-lkp committed Mar 19, 2021
1 parent 38b56e0 commit 4d3510a809c631ed53b78f7baa50fd4cc2730587
Showing 1 changed file with 5 additions and 1 deletion.
@@ -106,12 +106,16 @@ static int bpf_test_run(struct bpf_prog *prog, void *ctx, u32 repeat,

bpf_test_timer_enter(&t);
do {
bpf_cgroup_storage_set(storage);
ret = bpf_cgroup_storage_set(storage);
if (ret)
break;

if (xdp)
*retval = bpf_prog_run_xdp(prog, ctx);
else
*retval = BPF_PROG_RUN(prog, ctx);

bpf_cgroup_storage_unset();
} while (bpf_test_timer_continue(&t, repeat, &ret, time));
bpf_test_timer_leave(&t);

0 comments on commit 4d3510a

Please sign in to comment.