From patchwork Mon Mar 6 07:56:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 660912 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 3EB2AC77B72 for ; Mon, 6 Mar 2023 07:58:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229975AbjCFH6E (ORCPT ); Mon, 6 Mar 2023 02:58:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229812AbjCFH5l (ORCPT ); Mon, 6 Mar 2023 02:57:41 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D77421F900; Sun, 5 Mar 2023 23:57:39 -0800 (PST) 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 6C5DBB80CB3; Mon, 6 Mar 2023 07:57:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47FA3C433A0; Mon, 6 Mar 2023 07:57:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678089456; bh=7TZ6Ryi4qLzh/gGEJ5o6OzQmE+K2CCuNbOYeK44Wt5Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qHmzb4qknAa+64diW25JB7LUpUeFbjfyStzO548TnaOmwXOOmWx9iH4XyZWuite89 zFYdzbIB3uwbZ6ohEvzVP69suMk9Z4HzzV7QDBlgzeefeQ65IvB3Ie4F84+IKUG4oh 1D2jOS2OHRaMuoASYjHGN8H3/8XO+/JSKErf0xJvVod6Rmnw7X5uXSQO3/7/z47HGD XoSOf14CMXssE2RQxUqTxJV0u1DUOEPS6rDhbenMWUeA6G0ulFpISXFEX8vVCB3ffa XPshPnw8IQ0vG5rmZqUJ6+7vHw+iAthhIJbPFP4vkGGY8c0o9FxQ5BdB9uBKTg7Una nLCjvLlQZlozA== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pZ5jb-0000ht-PN; Mon, 06 Mar 2023 08:58:15 +0100 From: Johan Hovold To: Georgi Djakov Cc: "Shawn Guo" , "Sascha Hauer" , "Pengutronix Kernel Team" , "Fabio Estevam" , "NXP Linux Team" , "Andy Gross" , "Bjorn Andersson" , "Konrad Dybcio" , "Sylwester Nawrocki" , =?utf-8?b?QXJ0dXIgxZp3aWdv?= =?utf-8?b?xYQ=?= , "Krzysztof Kozlowski" , "Alim Akhtar" , "Thierry Reding" , "Jonathan Hunter" , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH v2 01/23] interconnect: fix mem leak when freeing nodes Date: Mon, 6 Mar 2023 08:56:29 +0100 Message-Id: <20230306075651.2449-2-johan+linaro@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230306075651.2449-1-johan+linaro@kernel.org> References: <20230306075651.2449-1-johan+linaro@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The node link array is allocated when adding links to a node but is not deallocated when nodes are destroyed. Fixes: 11f1ceca7031 ("interconnect: Add generic on-chip interconnect API") Cc: stable@vger.kernel.org # 5.1 Reviewed-by: Konrad Dybcio Signed-off-by: Johan Hovold --- drivers/interconnect/core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c index 0f392f59b135..5217f449eeec 100644 --- a/drivers/interconnect/core.c +++ b/drivers/interconnect/core.c @@ -850,6 +850,10 @@ void icc_node_destroy(int id) mutex_unlock(&icc_lock); + if (!node) + return; + + kfree(node->links); kfree(node); } EXPORT_SYMBOL_GPL(icc_node_destroy);