]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
perf bpf: Return value with unlocking in perf_env__find_btf()
authorBo YU <tsu.yubo@gmail.com>
Mon, 22 Apr 2019 08:01:38 +0000 (04:01 -0400)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 2 May 2019 20:00:19 +0000 (16:00 -0400)
In perf_env__find_btf(), we're returning without unlocking
"env->bpf_progs.lock". There may be cause lockdep issue.

Detected by CoversityScan, CID# 1444762:(program hangs(LOCK))

Signed-off-by: Bo YU <tsu.yubo@gmail.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Martin KaFai Lau <kafai@fb.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Song Liu <songliubraving@fb.com>
Cc: Yonghong Song <yhs@fb.com>
Cc: bpf@vger.kernel.org
Cc: netdev@vger.kernel.org
Fixes: 2db7b1e0bd49d: (perf bpf: Return NULL when RB tree lookup fails in perf_env__find_btf())
Link: http://lkml.kernel.org/r/20190422080138.10088-1-tsu.yubo@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/env.c

index 9494f9dc61ecac041e114ffa2553e287f416e30d..6a3eaf7d9353c5251f8c0d2a7f7ab6b6696ace0d 100644 (file)
@@ -115,8 +115,8 @@ struct btf_node *perf_env__find_btf(struct perf_env *env, __u32 btf_id)
        }
        node = NULL;
 
-       up_read(&env->bpf_progs.lock);
 out:
+       up_read(&env->bpf_progs.lock);
        return node;
 }