Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1612201rwb; Fri, 19 Aug 2022 06:39:38 -0700 (PDT) X-Google-Smtp-Source: AA6agR4/9oKThcQuV8CGXfKfTLBsifKOK0Hosa3xMl0pgWc24lJuq1M33nI2lHw0akoxqtJaF2u1 X-Received: by 2002:a05:6402:194e:b0:442:c81c:ca25 with SMTP id f14-20020a056402194e00b00442c81cca25mr6315465edz.137.1660916378334; Fri, 19 Aug 2022 06:39:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660916378; cv=none; d=google.com; s=arc-20160816; b=ZM6+tzLvy16DFEgPnoW0VJes4miULuC4jusxeZ3cRA9rS3fVmXYgF/xsnex+e4M7WX 3THwnl7EswvMG07KRnlxqBOV4NZW9EgbFW8rEzsdh5bLB41+nBbtpL5ZOELTFaITcjl0 hCzE5LcAYdykey1wvJ/6+7UCfe0K69rY0jqKQtfJ9DARnROMoPLM1L3rCi0gX89t3ou2 z4Lo7htvvWQsgx4GZixd/wZkxT/vz7CIzsh4jyxdjzUIyZ7U9W7UWJmhlCXXZY7RZokz lpEUiBjPNGuLvDKWz7tIhwCZxzj08T5mArgC2+Z0Jto7VS+1kgT1+9vpAb1UGVXK3X+1 IR8Q== 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=aCinikugJYVndQUsj373oQZplFjuolIVu8lSHwGAPyU=; b=GaIiu2+DZ+qCbsSRBLs1zNVwQxw3eRx06ThFPRP47zTokmdqjUOnp6cMxqRyalwiu2 sK+O4pJztcG1yRWBzQHubOZr7JAjNfTk+Z/5gX+lQtssfw0MrJa0eQYFmIkPo/FDTgmu RKC6dKtN1Ex9g+zsk71m8mDnVar+YOVCeVXDJiKxgahpjQ4mDwBpgjQnTKBw4Vnb1sDU nV49U2VaDXXkqfJN25ySv8aYWlo184v5RIj/JfaUDhGpgjXsffrbVw7yCF5QqXbH/wc+ J0rhH+jnML0u1O79yszmH9BegCckO3NNhidck7Q7wDGvjAfmc/kyCbsTwAts7C7Sbqy8 GbcA== 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 w11-20020a056402128b00b0043df9bafb50si2764982edv.574.2022.08.19.06.39.12; Fri, 19 Aug 2022 06:39:38 -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 S1349240AbiHSNKa (ORCPT + 99 others); Fri, 19 Aug 2022 09:10:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349227AbiHSNK1 (ORCPT ); Fri, 19 Aug 2022 09:10:27 -0400 Received: from jabberwock.ucw.cz (jabberwock.ucw.cz [46.255.230.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01177C924F; Fri, 19 Aug 2022 06:10:25 -0700 (PDT) Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 422631C0003; Fri, 19 Aug 2022 15:10:24 +0200 (CEST) Date: Fri, 19 Aug 2022 15:10:23 +0200 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Liang He , Mark Brown , Sasha Levin Subject: Re: [PATCH 5.15 218/779] regulator: of: Fix refcount leak bug in of_get_regulation_constraints() Message-ID: <20220819131023.GB11901@duo.ucw.cz> References: <20220815180337.130757997@linuxfoundation.org> <20220815180346.599459531@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="E39vaYmALEf/7YXx" Content-Disposition: inline In-Reply-To: <20220815180346.599459531@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 --E39vaYmALEf/7YXx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > From: Liang He >=20 > [ Upstream commit 66efb665cd5ad69b27dca8571bf89fc6b9c628a4 ] >=20 > We should call the of_node_put() for the reference returned by > of_get_child_by_name() which has increased the refcount. Looks okay, > +++ b/drivers/regulator/of_regulator.c > @@ -264,8 +264,12 @@ static int of_get_regulation_constraints(struct devi= ce *dev, > } > =20 > suspend_np =3D of_get_child_by_name(np, regulator_states[i]); > - if (!suspend_np || !suspend_state) > + if (!suspend_np) > continue; > + if (!suspend_state) { > + of_node_put(suspend_np); > + continue; > + } > =20 but note that of_node_put(NULL) should be okay, so this can be cleaned up. Best regards, Pavel --=20 DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany --E39vaYmALEf/7YXx Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCYv+LvwAKCRAw5/Bqldv6 8p0oAJ0TPKM6K3efzN4HCt1pYNDKkDVDLgCdGa7YicDIRb2Q2bd1/AA7pD9hzjE= =DwFx -----END PGP SIGNATURE----- --E39vaYmALEf/7YXx--