diff --git a/tools/testing/selftests/bpf/prog_tests/btf.c b/tools/testing/selftests/bpf/prog_tests/btf.c index 8fb4a04fbbc04..7feb4223bbacd 100644 --- a/tools/testing/selftests/bpf/prog_tests/btf.c +++ b/tools/testing/selftests/bpf/prog_tests/btf.c @@ -4629,6 +4629,7 @@ static int test_btf_id(unsigned int test_num) /* The map holds the last ref to BTF and its btf_id */ close(map_fd); + kern_sync_rcu(); map_fd = -1; btf_fd[0] = bpf_btf_get_fd_by_id(map_info.btf_id); if (CHECK(btf_fd[0] >= 0, "BTF lingers")) {