From patchwork Mon Oct 23 17:58:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonghong Song X-Patchwork-Id: 829539 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=fb.com header.i=@fb.com header.b="cD+TFU2F"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yLPJh2tvMz9sP1 for ; Tue, 24 Oct 2017 04:58:12 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932330AbdJWR6J (ORCPT ); Mon, 23 Oct 2017 13:58:09 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:49954 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932143AbdJWR6I (ORCPT ); Mon, 23 Oct 2017 13:58:08 -0400 Received: from pps.filterd (m0001255.ppops.net [127.0.0.1]) by mx0b-00082601.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9NHuYwF024995 for ; Mon, 23 Oct 2017 10:58:08 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=qlmCeX5pll5djRRnj8N6DUNopwBQriRkJoVJbt7A/jU=; b=cD+TFU2F3swrzqwYzzDTwIxqMgt41YysIb4PNX3p9Cpoxe3ajnxIA0LovLrJOcvNAsEu eqhj36PsPQX03igwMCEX7U70NfGqIbAsPsQWgkzI6sIm/GWztt0zjEnUp4nYMAN8pFLN /kYAICcW+TazO93Le0DUZVfCy18OoaA5smg= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0b-00082601.pphosted.com with ESMTP id 2dr22cw89v-4 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Mon, 23 Oct 2017 10:58:08 -0700 Received: from mx-out.facebook.com (192.168.52.123) by PRN-CHUB05.TheFacebook.com (192.168.16.15) with Microsoft SMTP Server id 14.3.319.2; Mon, 23 Oct 2017 10:58:06 -0700 Received: by devbig474.prn1.facebook.com (Postfix, from userid 128203) id B1B5AE411DA; Mon, 23 Oct 2017 10:58:05 -0700 (PDT) Smtp-Origin-Hostprefix: devbig From: Yonghong Song Smtp-Origin-Hostname: devbig474.prn1.facebook.com To: , , , , , CC: Smtp-Origin-Cluster: prn1c29 Subject: [PATCH net-next 1/3] bpf: use the same condition in perf event set/free bpf handler Date: Mon, 23 Oct 2017 10:58:03 -0700 Message-ID: <20171023175805.2898366-2-yhs@fb.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171023175805.2898366-1-yhs@fb.com> References: <20171023175805.2898366-1-yhs@fb.com> X-FB-Internal: Safe MIME-Version: 1.0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-23_08:, , signatures=0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- kernel/events/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index 31ee304..9f78a682 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -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) {