Skip to content

Commit

Permalink
bpf: use the same condition in perf event set/free bpf handler
Browse files Browse the repository at this point in the history
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 <yhs@fb.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Yonghong Song authored and David S. Miller committed Oct 25, 2017
1 parent 908d140 commit 0b4c684
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kernel/events/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -8191,10 +8191,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) {
Expand Down

0 comments on commit 0b4c684

Please sign in to comment.