From patchwork Wed Sep 23 11:22:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 54042 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id 7981A22E14 for ; Wed, 23 Sep 2015 11:26:05 +0000 (UTC) Received: by lacao8 with SMTP id ao8sf10530232lac.3 for ; Wed, 23 Sep 2015 04:26:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=Z/hktWQxPmkf0yDqMEiHNmihSNmrKxcYg89Ggx2z8FA=; b=UQ3+z6sSBMYkVDA+aMFEE4gTW1c+s+hA12iQmXY1WAcSr9FZi1jo3NP7nsxmltE8Au /zB8lm1OxMx5svZz9egXHewXdv2DjP5aJllxEwMy3jy8m4a1s2s/pQZQ79HYPTVmHDVQ i4ABN5gf7Vryw4baoVXpTYZ4rw6osghe4dwhnPsTY6LnIspMaFfTMRC1MY269uHGZ5ph g+VaS+wl4aXn3dysu7ugBb0FtGv5JjfmoxJVSgjMw1t0zsWt1mnLuci5gzqHSzXdGEYK 2QjIdRPGzb3Kmd4ONyKRnGh7QO8QlJppQvlaHnvfhpYSoyYqPgqHKEJPsciuLfvmI8Xg vBjw== X-Gm-Message-State: ALoCoQkPGLO+SVXYTcB+1iM3+/58kqgs4TeCOl1pJM6rsMhfAJoqeZkfz6NGJzbiYOOCInNwaPHs X-Received: by 10.152.3.131 with SMTP id c3mr5200739lac.4.1443007564397; Wed, 23 Sep 2015 04:26:04 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.161.20 with SMTP id k20ls96780lfe.88.gmail; Wed, 23 Sep 2015 04:26:04 -0700 (PDT) X-Received: by 10.152.1.162 with SMTP id 2mr11165628lan.61.1443007564233; Wed, 23 Sep 2015 04:26:04 -0700 (PDT) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id z4si3495710lae.168.2015.09.23.04.26.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Sep 2015 04:26:03 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by lahh2 with SMTP id h2so22112276lah.0 for ; Wed, 23 Sep 2015 04:26:03 -0700 (PDT) X-Received: by 10.25.210.206 with SMTP id j197mr3757603lfg.86.1443007563706; Wed, 23 Sep 2015 04:26:03 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1044356lbq; Wed, 23 Sep 2015 04:26:02 -0700 (PDT) X-Received: by 10.68.197.97 with SMTP id it1mr37342993pbc.4.1443007562457; Wed, 23 Sep 2015 04:26:02 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fe1si9907923pac.120.2015.09.23.04.26.01; Wed, 23 Sep 2015 04:26:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754484AbbIWLXr (ORCPT + 30 others); Wed, 23 Sep 2015 07:23:47 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:56810 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754400AbbIWLXo (ORCPT ); Wed, 23 Sep 2015 07:23:44 -0400 Received: from 172.24.1.49 (EHLO szxeml426-hub.china.huawei.com) ([172.24.1.49]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BNW12501; Wed, 23 Sep 2015 19:23:12 +0800 (CST) Received: from linux-4hy3.site (10.107.193.248) by szxeml426-hub.china.huawei.com (10.82.67.181) with Microsoft SMTP Server id 14.3.235.1; Wed, 23 Sep 2015 19:23:05 +0800 From: Wang Nan To: CC: , , Wang Nan , Alexei Starovoitov , Brendan Gregg , Daniel Borkmann , "David Ahern" , He Kuang , Jiri Olsa , Kaixu Xia , Masami Hiramatsu , Namhyung Kim , "Paul Mackerras" , Peter Zijlstra , Zefan Li Subject: [PATCH 11/22] perf probe: Reset args and nargs for probe_trace_event when failure Date: Wed, 23 Sep 2015 11:22:32 +0000 Message-ID: <1443007363-124182-12-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1443007363-124182-1-git-send-email-wangnan0@huawei.com> References: <1443007363-124182-1-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.107.193.248] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A010204.56028BA0.00A4, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 7dc425bc5c26fa1390348822dc7ec9c1 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: wangnan0@huawei.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , When failure occures in add_probe_trace_event(), args in probe_trace_event is incomplete. Since information in it may be used in futher, this patch frees the allocated memory and set it to NULL to avoid dangling pointer. Signed-off-by: Wang Nan Cc: Alexei Starovoitov Cc: Brendan Gregg Cc: Daniel Borkmann Cc: David Ahern Cc: He Kuang Cc: Jiri Olsa Cc: Kaixu Xia Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Zefan Li Cc: pi3orama@163.com Cc: Arnaldo Carvalho de Melo Link: http://lkml.kernel.org/n/ebpf-6yw9eg0ej3l4jnqhinngkw86@git.kernel.org --- tools/perf/util/probe-finder.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 29c43c068..5ab9cd6 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c @@ -1228,6 +1228,10 @@ static int add_probe_trace_event(Dwarf_Die *sc_die, struct probe_finder *pf) end: free(args); + if (ret) { + tev->nargs = 0; + zfree(&tev->args); + } return ret; }