perf header: Fix lock/unlock imbalances when processing BPF/BTF info
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Mon, 8 Apr 2019 17:33:55 +0000 (12:33 -0500)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 16 Apr 2019 14:26:43 +0000 (11:26 -0300)
commit14c9b31a925a9f5c647523a12e2b575b97c0aa47
tree571d7821a18120fc9e5aeea715b1816b57ee508a
parent9d5dcc93a6ddfc78124f006ccd3637ce070ef2fc
perf header: Fix lock/unlock imbalances when processing BPF/BTF info

Fix lock/unlock imbalances by refactoring the code a bit and adding
calls to up_write() before return.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Song Liu <songliubraving@fb.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Addresses-Coverity-ID: 1444315 ("Missing unlock")
Addresses-Coverity-ID: 1444316 ("Missing unlock")
Fixes: a70a1123174a ("perf bpf: Save BTF information as headers to perf.data")
Fixes: 606f972b1361 ("perf bpf: Save bpf_prog_info information as headers to perf.data")
Link: http://lkml.kernel.org/r/20190408173355.GA10501@embeddedor
[ Simplified the exit path to have just one up_write() + return ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/header.c