Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3676841pxv; Mon, 26 Jul 2021 09:12:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSVR1buFNipvtVMcAyvc7QXBVhS6rm4GYyHxZl/tLXYwcAeNi/bzJN42TsmnOSCSXLzySn X-Received: by 2002:a17:906:c087:: with SMTP id f7mr17227888ejz.487.1627315938374; Mon, 26 Jul 2021 09:12:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627315938; cv=none; d=google.com; s=arc-20160816; b=nw/xWgGdYBvOKKywC+2Io36DMTL5HDkD/uDPum63yn79MH/8gHjTQc6EyRq+FFeZfH gqIkgtHhE7wR9/P2TyCKhjkuuILmfViI1RT63w/Chj9O1m5/Z5xZAvQXZwuPS7hpwwLr ZTSnL2r/ATaNlKhgpp/XZvG760ui2HjnrVlexkEVGNMuzjrz0UXAp34lA7wDawAQFZQ8 aV10Be/etjhHARYzaW1upyC4ciWoTwSw+71QnPkamt8lZjSNpjTZUiYamVzyDXXB7aOt LoSeWAyoBTpmgRSilEpANV+mBRaegMF9n+6B7j2w0D6JiBD9qgTNmrbQwnqftW2ujdtZ gH4A== 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=ZwgQ8khm66Y15mG1W5Fz/khRNDm5tmKrQ4Zg3H5LiyA=; b=XDWOq9FA60lWhgXbqtj1rygGXQIps2jDElLIYhNoudcwEjMU51PO3r7lYfMUS7+D4d /g8pEv6OvQV6Qzkb5D/cojJ25lL1CSqW3BzC1uozx68FXluMGAGTI9GFjrvO2cGr55VG qSC8mtgQqkYE/EAGAwSEnCe6FpyA5h5pdq4RfRwOaDZhrzgpY/87YMZcMw2685qh5B3w OMpWNbvzXfXozemetWqrGymHn58QYhFDk/HDSooaXjhl90q6GkH2XKu56JF0Qe2tMrVY Wr+JDamsgCpnBvj9iMtk4qjyzkFYaLu5c7SSVTOXq8cU2IJR4oIUshoMSwSUgzRbKovK qgHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eiFbFqdZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g22si291150edb.11.2021.07.26.09.11.54; Mon, 26 Jul 2021 09:12:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eiFbFqdZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S237791AbhGZP3X (ORCPT + 99 others); Mon, 26 Jul 2021 11:29:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:56870 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236333AbhGZPQy (ORCPT ); Mon, 26 Jul 2021 11:16:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2411960F42; Mon, 26 Jul 2021 15:57:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1627315042; bh=/B2xbLMtnaIWiO1buscDhTGJ69/lT0j2/pRh5lQ72xE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eiFbFqdZf4xzeJdTUM1t1LU2MCcadB+39eQnX3nGxk6zczKW9RD74LDxXVXGXOS/q 9tXvCm3MUNAXpHnBePx/2kKrx932XSqntvapgaq9WKzt0Om+8OAMU8DaePf1soMaUZ xCsGDAj9+OQlPCsgRqXW7U9JH5+GSAlnNMh9uKpQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Riccardo Mancini , Ian Rogers , Jiri Olsa , Mark Rutland , Namhyung Kim , Peter Zijlstra , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.4 028/108] perf probe-file: Delete namelist in del_events() on the error path Date: Mon, 26 Jul 2021 17:38:29 +0200 Message-Id: <20210726153832.601436778@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210726153831.696295003@linuxfoundation.org> References: <20210726153831.696295003@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Riccardo Mancini [ Upstream commit e0fa7ab42232e742dcb3de9f3c1f6127b5adc019 ] ASan reports some memory leaks when running: # perf test "42: BPF filter" This second leak is caused by a strlist not being dellocated on error inside probe_file__del_events. This patch adds a goto label before the deallocation and makes the error path jump to it. Signed-off-by: Riccardo Mancini Fixes: e7895e422e4da63d ("perf probe: Split del_perf_probe_events()") Cc: Ian Rogers Cc: Jiri Olsa Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lore.kernel.org/lkml/174963c587ae77fa108af794669998e4ae558338.1626343282.git.rickyman7@gmail.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/util/probe-file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c index f778f8e7e65a..5558e2adebe4 100644 --- a/tools/perf/util/probe-file.c +++ b/tools/perf/util/probe-file.c @@ -337,11 +337,11 @@ int probe_file__del_events(int fd, struct strfilter *filter) ret = probe_file__get_events(fd, filter, namelist); if (ret < 0) - return ret; + goto out; ret = probe_file__del_strlist(fd, namelist); +out: strlist__delete(namelist); - return ret; } -- 2.30.2