Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1601616rwb; Fri, 19 Aug 2022 06:30:29 -0700 (PDT) X-Google-Smtp-Source: AA6agR6WYX9D2GxjehwN7VEuwKA5T4JYZ7UYUR30hN0i+d8kXXmFdZUOmc3avnOR52xNbSUwZ4Pb X-Received: by 2002:a17:906:cc0e:b0:731:6843:c198 with SMTP id ml14-20020a170906cc0e00b007316843c198mr4918944ejb.507.1660915829436; Fri, 19 Aug 2022 06:30:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660915829; cv=none; d=google.com; s=arc-20160816; b=Rpi1i1xxRcOhpilnzvQRCOl2J7CLdL5/Cf4gUEVeF4tY4onEjkG3UkQ0WHb+xbevsd xx8GuLkkzyPKccW358kgxAXWozymLCywcDdF6JzJ5jwMMnylO/5Uw3G2KPcjqmnDIwDj R+tErr+Dr1MzNWHulJf2vK5+HbFSLbzBfZFvARzIBhzt1Kt1/dMo2kdcLYUapHnO9D52 oKJta07OFWg1zBtBCj2Tamvt6ctqtHkEPNLOkKjxvvpUou/CdlV9ksWgugC96JXUF+Fu JgHcOIgrfS+vbGAV0bTrNwud4Xz9lXHCPQMFgPPqw9BD1HB0tDp52XVdPwqahLqoe8Im Zivg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=sIXzudyPhBfhOPLZs/JI3sR3uO551RpBIovKZbocYLw=; b=BRwcA49rjtMpbbO0YjK4NjFdMsSynGxxqasVvIfM6ajMPfNhe3ODGok5y5vT4TjkBg aZzPHOSoTXetLZw1oWxDlrr1nmEms4yXDqBzYV8p9AAtVMawd1gU9y8OJdHDgEIcY41r iBtIFn5K4oq4o+rmcZd1iyFZvo4UBTCaU2a2OxG8o8NPB+DGMCL0zQ6GfgTubCAntHaN OCpcYB47luahl4uwDs4musi2WO9PmTZxJ1FEmIyL3/sXCtiQBDOuWEhu0C+VRnInT0fL nSQCvXuinJ8J1FBlmubLQbEhWvhqSrYE6+prxwIp3897uo8e2EhKHUqjs5Ilgeg0uvtp 7E5w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i15-20020a1709064fcf00b0072f22d91836si3416152ejw.541.2022.08.19.06.30.02; Fri, 19 Aug 2022 06:30:29 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349349AbiHSNO3 (ORCPT + 99 others); Fri, 19 Aug 2022 09:14:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348424AbiHSNO1 (ORCPT ); Fri, 19 Aug 2022 09:14:27 -0400 Received: from jabberwock.ucw.cz (jabberwock.ucw.cz [46.255.230.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D6F619C31; Fri, 19 Aug 2022 06:14:26 -0700 (PDT) Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 13F2B1C0003; Fri, 19 Aug 2022 15:14:25 +0200 (CEST) Date: Fri, 19 Aug 2022 15:14:24 +0200 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Miaoqian Lin , Mark Brown , Sasha Levin Subject: Re: [PATCH 5.15 565/779] ASoC: mt6797-mt6351: Fix refcount leak in mt6797_mt6351_dev_probe Message-ID: <20220819131424.GC11901@duo.ucw.cz> References: <20220815180337.130757997@linuxfoundation.org> <20220815180401.467155717@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="c3bfwLpm8qysLVxt" Content-Disposition: inline In-Reply-To: <20220815180401.467155717@linuxfoundation.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NEUTRAL,T_SCC_BODY_TEXT_LINE autolearn=no 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 --c3bfwLpm8qysLVxt Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > From: Miaoqian Lin >=20 > [ Upstream commit 7472eb8d7dd12b6b9b1a4f4527719cc9c7f5965f ] >=20 > 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. AFAICT this has serious problems: > +++ b/sound/soc/mediatek/mt6797/mt6797-mt6351.c > @@ -217,7 +217,8 @@ static int mt6797_mt6351_dev_probe(struct platform_de= vice *pdev) > if (!codec_node) { > dev_err(&pdev->dev, > "Property 'audio-codec' missing or invalid\n"); > - return -EINVAL; > + ret =3D -EINVAL; > + goto put_platform_node; > } > for_each_card_prelinks(card, i, dai_link) { > if (dai_link->codecs->name) > @@ -230,6 +231,9 @@ static int mt6797_mt6351_dev_probe(struct platform_de= vice *pdev) > dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", > __func__, ret); > =20 > + of_node_put(codec_node); > +put_platform_node: > + of_node_put(platform_node); > return ret; > } platform_node is stashed away in struct, and so is codec_node; we should not be freeing those references in success case, right? dai_link->platforms->of_node =3D platform_node; Best regards, Pavel --=20 DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany --c3bfwLpm8qysLVxt Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCYv+MsAAKCRAw5/Bqldv6 8lRcAJ9hyOCiDVWb3RAM5/pp+76QaJb1zwCfTF/SH5XHwMA4dbrA9qYxUcJ7fY8= =gdKK -----END PGP SIGNATURE----- --c3bfwLpm8qysLVxt--