From patchwork Tue Apr 5 07:17:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 558119 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FF6AC433F5 for ; Tue, 5 Apr 2022 08:07:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233707AbiDEIIz (ORCPT ); Tue, 5 Apr 2022 04:08:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233680AbiDEH5X (ORCPT ); Tue, 5 Apr 2022 03:57:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E5704E39D; Tue, 5 Apr 2022 00:51:16 -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 dfw.source.kernel.org (Postfix) with ESMTPS id EDB24616DF; Tue, 5 Apr 2022 07:51:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AD09C340EE; Tue, 5 Apr 2022 07:51:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649145069; bh=pX0CfYZCeQp8gvJICNjx0ctHFHPgELNEM/GZ3dqwyq0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z4n7HMdiUouUOtJU8BvcMXqplpN0rN4HeZvhLpDpGwCVkpwJsD0WXerKAVctcXwqG O503rai5N+MLbmn+H0thnM/RmRsrQrGFyin9U4l2qXbOTz6lxjT02kTE0bnyFfkDwi sYTvle/EG7GC9eYk7zsW1ooQzmRrF44I9cx2HPRY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adrian Hunter , "Peter Zijlstra (Intel)" , Sasha Levin Subject: [PATCH 5.17 0274/1126] perf/core: Fix address filter parser for multiple filters Date: Tue, 5 Apr 2022 09:17:01 +0200 Message-Id: <20220405070415.652707892@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070407.513532867@linuxfoundation.org> References: <20220405070407.513532867@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Adrian Hunter [ Upstream commit d680ff24e9e14444c63945b43a37ede7cd6958f9 ] Reset appropriate variables in the parser loop between parsing separate filters, so that they do not interfere with parsing the next filter. Fixes: 375637bc524952 ("perf/core: Introduce address range filtering") Signed-off-by: Adrian Hunter Signed-off-by: Peter Zijlstra (Intel) Link: https://lore.kernel.org/r/20220131072453.2839535-4-adrian.hunter@intel.com Signed-off-by: Sasha Levin --- kernel/events/core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/events/core.c b/kernel/events/core.c index 6859229497b1..69cf71d97312 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -10574,8 +10574,11 @@ perf_event_parse_addr_filter(struct perf_event *event, char *fstr, } /* ready to consume more filters */ + kfree(filename); + filename = NULL; state = IF_STATE_ACTION; filter = NULL; + kernel = 0; } }