Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3335299rwa; Tue, 23 Aug 2022 03:04:55 -0700 (PDT) X-Google-Smtp-Source: AA6agR7hgy+vRVRRDzLkHPBNhuh6iUxAbA6t8fmF2pKRWu3EGMpoFCckA2lUVquU83AI28ZUh0SV X-Received: by 2002:a63:9142:0:b0:422:eb76:1965 with SMTP id l63-20020a639142000000b00422eb761965mr19733028pge.160.1661249095736; Tue, 23 Aug 2022 03:04:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661249095; cv=none; d=google.com; s=arc-20160816; b=nTQPA+VmPu/CQqyEod0xhmSDml8Rndxd2v9B967ysccM0U2qmMFMX4FIJTeDlKu7Ef V97DnMGKokKCck33BwJ0VPOCJjg8o+YSIeBgZRnw0WeDrbLI/r4XdoYt3nz6ggkJVGP+ iP9C226yrQhRy5vMQjHZNt809yegVSIZr5yK4m5YIR1KS9yWdPuFLWMKoCoBybDI0LHH FaMiggBfsjozmifFhAgpaW/vkyFmfq7hRiQ0Bgttq20AyxE5Rdgl0W9QyCK5AqugG+B7 KIRZOHXn0SBft7DI9ryIwzIWKAH+HjbBa7dSswUttl0RNv+RExpnI2tjZUK8Va1jyoAi A83A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RFWjjYnn+QiBKD27hB+cXDcX/5ywvoufSKBLKLjuqcE=; b=CzqJgpquTL41XASxcXyYes9zlaTDV2ZikongZaoeYS5hgi0y0DWSaeMJDkplQF9oYI GfF1hzfvgAh7kwgy5xyOZvjnIpeDSTLX8pUIBEySe9KKiFHbLDNbbRUvwBY/isxLKY3Z hrspwGp1G/1VKRfogkYHywYeTISZoUS2TdeBs1UINHqdEkkSqJgV3OvGUTGzL4VApj92 8+oNWh0DRM69yrAGX+Glb/l1W4mr9w9mK5x0wvY8fgMZucPlAajvczUNN9MFmP5zdb5V Mt4hipaioxk/JjVbdkGMR6ZcSr6IgT+z2fkrwhY98NvTsl8DFAhjnIydyclbIms26BiG 31zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=puEF5Obl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hk14-20020a17090b224e00b001f617f345bbsi15150578pjb.110.2022.08.23.03.04.43; Tue, 23 Aug 2022 03:04:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=puEF5Obl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243388AbiHWJyl (ORCPT + 99 others); Tue, 23 Aug 2022 05:54:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352299AbiHWJva (ORCPT ); Tue, 23 Aug 2022 05:51:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B596C9F0E7; Tue, 23 Aug 2022 01:45:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1DC8DB81C3A; Tue, 23 Aug 2022 08:17:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56D1AC433D6; Tue, 23 Aug 2022 08:17:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242654; bh=OiF9Vciiallwzx+M+oH/zhtKHR7aGt/6vvnZGDtF6Fw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=puEF5OblHnDjNgbEYeyoerQyQMQAfozr9ze7RFUOvt82CNvm7nrHNO9ukOSDcTZdz JZejbjQRPQ4CXE0OElFtPViwGRPPTmpXQlTCbpgmo53JBGV6AA2dM0ywOOW+KIh+ok aMH3HPL5p3sXrdOx+UWvo+HE2bjZWPz93sYNC22Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Masami Hiramatsu , Alexander Shishkin , Ingo Molnar , Jiri Olsa , kernel-janitors@vger.kernel.org, Mark Rutland , Namhyung Kim , Peter Zijlstra , Arnaldo Carvalho de Melo Subject: [PATCH 5.19 155/365] perf probe: Fix an error handling path in parse_perf_probe_command() Date: Tue, 23 Aug 2022 10:00:56 +0200 Message-Id: <20220823080124.707978080@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe JAILLET commit 4bf6dcaa93bcd083a13c278a91418fe10e6d23a0 upstream. If a memory allocation fail, we should branch to the error handling path in order to free some resources allocated a few lines above. Fixes: 15354d54698648e2 ("perf probe: Generate event name with line number") Signed-off-by: Christophe JAILLET Acked-by: Masami Hiramatsu Cc: Alexander Shishkin Cc: Ingo Molnar Cc: Jiri Olsa Cc: kernel-janitors@vger.kernel.org Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Link: https://lore.kernel.org/r/b71bcb01fa0c7b9778647235c3ab490f699ba278.1659797452.git.christophe.jaillet@wanadoo.fr Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/perf/util/probe-event.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -1775,8 +1775,10 @@ int parse_perf_probe_command(const char if (!pev->event && pev->point.function && pev->point.line && !pev->point.lazy_line && !pev->point.offset) { if (asprintf(&pev->event, "%s_L%d", pev->point.function, - pev->point.line) < 0) - return -ENOMEM; + pev->point.line) < 0) { + ret = -ENOMEM; + goto out; + } } /* Copy arguments and ensure return probe has no C argument */