Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3469163rwa; Tue, 23 Aug 2022 05:23:50 -0700 (PDT) X-Google-Smtp-Source: AA6agR6OFH5MVUHXG+cxMOEjlXh8GA7yg5amORmQA2zHICBY8O3NieI0nmzs8D3THnXHUNKZ0lJ4 X-Received: by 2002:a05:6a00:114c:b0:528:2c7a:6302 with SMTP id b12-20020a056a00114c00b005282c7a6302mr25077531pfm.37.1661257429811; Tue, 23 Aug 2022 05:23:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661257429; cv=none; d=google.com; s=arc-20160816; b=nysa/+brVOmrHpDwNnrBPFJW6eeVFx9kAg+5/i4Eb3ludlSY0DLZIOPL4MBetfS2ye GVD5ZvSU+YwWw0J/+YaEvpY35hA4Lf9Dpr6cLoKaM0LcbqeP2P+/PtLDxYKJg6gMBWrR noHrMV8Jw3AOtEGBOmTRQzGDkdzJo46P9HhONuybWXSWMPa5WEkBgkt0Di5U0Gqk6JGA +nmYi1I0wQ4HszKU7VUlhQohpUsPPqyeZ8uR7XGh8YrRA0tyT0Ij7HIJtYSBDqGf3Z42 rH8Bb1u8w5o5DVGKFUpJTgv4MS3t/d9gm5mZOK7sPvwE2ayQQh3QE2DIUDmyueszqOSr BP1g== 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=zWpeDSVOdmFEiXxzlFJbIaZ0cGBUF2TWgwzITiTKQP8cfv1o5TuVT8MfwyP31ml5+k Mhm/n/oT8MEx7gBUFcIA765v9z9/MrPg5O8SBYPaWiI3zSs4x2On7iKm6xRnjAvRXyQm VsyVDflkZLuvdJGhVixTlcHZT0UB4MXaxQstfKJB+eohpQSWl8jFQm/XeusQe20A7sf1 LOeCogEw72VYBYRk+I60xcjMpBlHVlytgEbP9UBRSUlyh8zxYOti9ubv5L9OZ5f2ojEw KwghrJ1FXRxifaQBq0GtNz+0QlZ/xIXHGTqApNvTil9BYE3SXA4I7P/G0SkptWQbGkGM u80g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AFQSIxUG; 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 t10-20020a63460a000000b0041b9a820023si15760329pga.264.2022.08.23.05.23.39; Tue, 23 Aug 2022 05:23:49 -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=AFQSIxUG; 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 S1351860AbiHWKD5 (ORCPT + 99 others); Tue, 23 Aug 2022 06:03:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242892AbiHWJ6X (ORCPT ); Tue, 23 Aug 2022 05:58:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30FEFA1D4A; Tue, 23 Aug 2022 01:47:58 -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 5E3D5B81C3A; Tue, 23 Aug 2022 08:47:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DAE6C433C1; Tue, 23 Aug 2022 08:47:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661244475; bh=OiF9Vciiallwzx+M+oH/zhtKHR7aGt/6vvnZGDtF6Fw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AFQSIxUGVQflSEoQWPU7SDJojrP9HrBpgXxlSbXBPw/siSOIZKOlc2onbkfeQ3k8O ox2FDtdi8EK5ap5ap+rbXNNVCZmLU9qVak2W6Y1o0txNpnC6dpFj7TCESbg+Uh15iE GWC+EjTt4QBL9kLIfy64sAj70ul/V1OjluhlbOtw= 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.15 099/244] perf probe: Fix an error handling path in parse_perf_probe_command() Date: Tue, 23 Aug 2022 10:24:18 +0200 Message-Id: <20220823080102.334584924@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080059.091088642@linuxfoundation.org> References: <20220823080059.091088642@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 */