From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C478C433DF for ; Wed, 19 Aug 2020 13:21:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4581F205CB for ; Wed, 19 Aug 2020 13:21:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597843318; bh=60Yph/4drOQ70zUxNIoJeeOSoXz1md0GPHJbSpifDck=; h=Subject:To:Cc:From:Date:List-ID:From; b=vhnzI1GlsNPjVGF6YWrPnsCUEwMvKskxQCQ4FhkFRLuHvqYEY1iET55D0BZLW5Q7X 1xT3sff8DCwg38LObVF46dkN/SHne7g0uKQShbQtK863dfCjUELqSa/h7mOIhkvdjD tAEHer3Qq5AGfkJf/b4n+8memGYj/us4a5DrGmxQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728445AbgHSNVy (ORCPT ); Wed, 19 Aug 2020 09:21:54 -0400 Received: from wforward3-smtp.messagingengine.com ([64.147.123.22]:46415 "EHLO wforward3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728364AbgHSNUM (ORCPT ); Wed, 19 Aug 2020 09:20:12 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailforward.west.internal (Postfix) with ESMTP id 0346CC25; Wed, 19 Aug 2020 09:19:21 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 19 Aug 2020 09:19:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=9s0lkX ofQvFUIzayr+Idg1X0tr5Hv4Ans0tEUN5X7DA=; b=gg7/Odwj8iiVy2ycR+Aiyd XFKyU3Z0liGDTVYqW+xFRoEkqMHBpHn1oN4w3yH4oFEMVI/xsfE8QyRFEvot6Age BdOqxtt8euxFLXvd4EoZ+4ey0b7eoanKEkCog8rE8VU9Cs5s5fIqK37gEAGa7RiF 8OrLJu9ynZZ0Ks+tHUpLWu7bcCTFH9pvfofeENk5LEKM94PTAXSNFa8mtTtPsC6l WI8JO4iL57VKliXtCx/PBtutAQ2Y9Zc7ckRu/3/z/Th8Nigm3md9Wq72eTd1SJYm zrpvFejf98ADWiboKnPJM/4K3oo8km4ppd6yKsRkfgmURl1ZxKyDSaHm1oNikObA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedruddtkedggeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtlfenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecuggftrfgrthhtvghrnhepueelleetteehudfgffeujedtgeehueekgfdtvdegle ekgfegudffteffveetueejnecuffhomhgrihhnpehnthgvvhhsrdhinhdpkhgvrhhnvghl rdhorhhgnecukfhppeekfedrkeeirdekledruddtjeenucevlhhushhtvghrufhiiigvpe dunecurfgrrhgrmhepmhgrihhlfhhrohhmpehgrhgvgheskhhrohgrhhdrtghomh X-ME-Proxy: Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id 26E36328005A; Wed, 19 Aug 2020 09:19:21 -0400 (EDT) Subject: FAILED: patch "[PATCH] perf probe: Fix memory leakage when the probe point is not" failed to apply to 4.19-stable tree To: mhiramat@kernel.org, acme@redhat.com, ak@linux.intel.com, oleg@redhat.com, srikar@linux.vnet.ibm.com Cc: From: Date: Wed, 19 Aug 2020 15:19:41 +0200 Message-ID: <1597843181245121@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.19-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 12d572e785b15bc764e956caaa8a4c846fd15694 Mon Sep 17 00:00:00 2001 From: Masami Hiramatsu Date: Fri, 10 Jul 2020 22:11:23 +0900 Subject: [PATCH] perf probe: Fix memory leakage when the probe point is not found Fix the memory leakage in debuginfo__find_trace_events() when the probe point is not found in the debuginfo. If there is no probe point found in the debuginfo, debuginfo__find_probes() will NOT return -ENOENT, but 0. Thus the caller of debuginfo__find_probes() must check the tf.ntevs and release the allocated memory for the array of struct probe_trace_event. The current code releases the memory only if the debuginfo__find_probes() hits an error but not checks tf.ntevs. In the result, the memory allocated on *tevs are not released if tf.ntevs == 0. This fixes the memory leakage by checking tf.ntevs == 0 in addition to ret < 0. Fixes: ff741783506c ("perf probe: Introduce debuginfo to encapsulate dwarf information") Signed-off-by: Masami Hiramatsu Reviewed-by: Srikar Dronamraju Cc: Andi Kleen Cc: Oleg Nesterov Cc: stable@vger.kernel.org Link: http://lore.kernel.org/lkml/159438668346.62703.10887420400718492503.stgit@devnote2 Signed-off-by: Arnaldo Carvalho de Melo diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 9963e4e8ea20..659024342e9a 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c @@ -1467,7 +1467,7 @@ int debuginfo__find_trace_events(struct debuginfo *dbg, if (ret >= 0 && tf.pf.skip_empty_arg) ret = fill_empty_trace_arg(pev, tf.tevs, tf.ntevs); - if (ret < 0) { + if (ret < 0 || tf.ntevs == 0) { for (i = 0; i < tf.ntevs; i++) clear_probe_trace_event(&tf.tevs[i]); zfree(tevs);