From: Yonghong Song Date: Tue, 24 Oct 2017 06:53:07 +0000 (-0700) Subject: UPSTREAM: bpf: use the same condition in perf event set/free bpf handler X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4b35333c5ad1fca307aece5aae7501699216856d;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git UPSTREAM: bpf: use the same condition in perf event set/free bpf handler This is a cleanup such that doing the same check in perf_event_free_bpf_prog as we already do in perf_event_set_bpf_prog step. Signed-off-by: Yonghong Song Acked-by: Alexei Starovoitov Acked-by: Martin KaFai Lau Signed-off-by: David S. Miller (cherry picked from commit 0b4c6841fee03e096b735074a0c4aab3a8e92986) Signed-off-by: Connor O'Brien Bug: 121213201 Bug: 138317270 Test: build & boot cuttlefish Change-Id: Id64d5a025d383fa3d3b16c5c74e8f9e86148efaa --- diff --git a/kernel/events/core.c b/kernel/events/core.c index 09505311220d..05493c5b1566 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -8254,10 +8254,10 @@ static void perf_event_free_bpf_prog(struct perf_event *event) { struct bpf_prog *prog; - perf_event_free_bpf_handler(event); - - if (!event->tp_event) + if (event->attr.type != PERF_TYPE_TRACEPOINT) { + perf_event_free_bpf_handler(event); return; + } prog = event->tp_event->prog; if (prog && event->tp_event->bpf_prog_owner == event) {