From nobody Fri Sep 5 20:25:39 2025 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 717A6C32793 for ; Tue, 23 Aug 2022 11:53:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358695AbiHWLxG (ORCPT ); Tue, 23 Aug 2022 07:53:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358630AbiHWLu3 (ORCPT ); Tue, 23 Aug 2022 07:50:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09FE677EAD; Tue, 23 Aug 2022 02:31:22 -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 9B98A61381; Tue, 23 Aug 2022 09:31:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EC7EC433D7; Tue, 23 Aug 2022 09:31:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661247081; bh=GP7gmRHQuHjUHcEaZL42Q5Iqqab1OgWQDLMASb+3ke8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h2Ul+q91qWn+FYBPifcCOsgNtg1TOL2muoue2MY1bZ0LMguFJrkxESZeSZASw8j2/ AtUJh4ys5RfGTiuvPQ3JTllIaCPuqW/wrvjVsLbtIMm1N/idanwcPYq+FsEtysKcPH o64yaz0yaFivWr1Iq2lxRj9gIT7F76PgasHV4CV0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Linus Walleij Subject: [PATCH 5.4 312/389] pinctrl: nomadik: Fix refcount leak in nmk_pinctrl_dt_subnode_to_map Date: Tue, 23 Aug 2022 10:26:30 +0200 Message-Id: <20220823080128.603567365@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080115.331990024@linuxfoundation.org> References: <20220823080115.331990024@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin commit 4b32e054335ea0ce50967f63a7bfd4db058b14b9 upstream. of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak." Fixes: c2f6d059abfc ("pinctrl: nomadik: refactor DT parser to take two path= s") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220607111602.57355-1-linmq006@gmail.com Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman --- drivers/pinctrl/nomadik/pinctrl-nomadik.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/pinctrl/nomadik/pinctrl-nomadik.c +++ b/drivers/pinctrl/nomadik/pinctrl-nomadik.c @@ -1461,8 +1461,10 @@ static int nmk_pinctrl_dt_subnode_to_map =20 has_config =3D nmk_pinctrl_dt_get_config(np, &configs); np_config =3D of_parse_phandle(np, "ste,config", 0); - if (np_config) + if (np_config) { has_config |=3D nmk_pinctrl_dt_get_config(np_config, &configs); + of_node_put(np_config); + } if (has_config) { const char *gpio_name; const char *pin;