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 C59B6C433E1 for ; Wed, 19 Aug 2020 13:21:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8E79D2078D for ; Wed, 19 Aug 2020 13:21:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597843262; bh=XpxXHRLlwTx38Q5tYNvCJYBdsbHknAU26f49yY6mZUI=; h=Subject:To:Cc:From:Date:List-ID:From; b=igQk9DGvSk8yt7PIRjfDg60qFpd6GfPxGezB7ZuIx/Z11q5IRpR5z484EPWRJ1bKx aobS1XF+6/AsIoijYpvHILAOrgp0PcV2YV6so28dafD/ohlH95EF5RPU5U88tW+XSC hPaBlAxBxh0ItE9cOb3fg4kBLuenquByFlCmPB4w= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728366AbgHSNUt (ORCPT ); Wed, 19 Aug 2020 09:20:49 -0400 Received: from wforward3-smtp.messagingengine.com ([64.147.123.22]:41035 "EHLO wforward3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728306AbgHSNUE (ORCPT ); Wed, 19 Aug 2020 09:20:04 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailforward.west.internal (Postfix) with ESMTP id B0F27BE3; Wed, 19 Aug 2020 09:19:18 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 19 Aug 2020 09:19:19 -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=tfj8ws lJEWc3496wgUlAFR3KTyJPu/JgSOgR+YG9SU4=; b=A/Sh4V3lb4LDp8d0VJOKW2 etlC9WHEU/XNoAIrAEItGB5nfO66miqgcV8nB+e2OPCPcyd01lWRfdKaC+5kHr9y 9bs9h0PJ247hCMDYRIFBnyE72jfgZz1fzUp0O3V/uhXe/JMeafWqABmENlz/zK2U yX27itt7/9E8QcCr8sdJg9sYQJFm7mPOSZ1QvzCtSUzwjaCEkkXlLPTwJjIFYMby O0EdCXeUd6xnmLpJCc91/LRfdfUwF7w6jSncL8/QgPO/+kMglkOh5qY4pOl5IGS8 Wkzz0Tcd47Hj79MQcbR3ar4h0fsmJSMciwDjxJ9LnbjIaF3aYI3MX3tZdz8dJK1Q == 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 D5A043280060; Wed, 19 Aug 2020 09:19:17 -0400 (EDT) Subject: FAILED: patch "[PATCH] perf probe: Fix memory leakage when the probe point is not" failed to apply to 4.9-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:39 +0200 Message-ID: <159784317962126@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.9-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);