Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp671671ioo; Thu, 26 May 2022 11:51:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJSjzw5hf2x+WzEufS0lGleobG7HCcVt6xkDwXnWijdH7bbLrC/L/I1xV+lvhmnmVJ5ejR X-Received: by 2002:a17:902:f650:b0:15f:3a10:a020 with SMTP id m16-20020a170902f65000b0015f3a10a020mr38683116plg.61.1653591096286; Thu, 26 May 2022 11:51:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653591096; cv=none; d=google.com; s=arc-20160816; b=RMWNJI9EjOIinELEwxj+1oCZDPZlAxJsgf9KoJuLtL86aKlh3yLJeim6ywBMQoHL7z s36NwndgQAig13TLkuUEEOts9jSaRo4WaT8qQFm90y4OllSdzSaz4LAgs3Xbvdsgt87F UOXkieLW6qtMpZTNNDIyCfzsETLsCg/V2Y4Q9Ny9V5WBOTFMj/l06UFphIy8XsyoL0W/ zUPMAGsewS1Gk+eVpF2a3OEz37s9wRUjLnx1bUCmZnjEie9cBj8MzDteSVUl2jaAnXae SpT444aq0qlmpzbQeM/0aeHjjWtUMN2ZIXJH08hHHXl6iSORyWxEXaUc/UMzC87VkrFI 7PcA== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=aYMZoYW/KYJSg/dEPHvkMHboEnKlicxsaXO8RSTrl2M=; b=gTDv1+65kbb9c4+ZUsV6IJ6t8LuTpAguuSUJK4DkYixEvO8wI5zN4PJXVFejrOE26d WgakGLeiBM2V9jCxp7NWg00X/Xf1mwoGagOewO8hDp8ONKoggxHyp+c0sAHVUpV2TlX9 k+akk4otqVR2RifD6ChWYD/QAm0dPM+Clt2k+xRWSagwTQbi/zi8vb758h/xXaBAEwmA N2Z8YzubgExVyVezPNM8taWoBygMrc+VSrgX4PWoqTBECLr6eCrFV0c/diTfNtG6kX9g ZVhlobQ57MhZNsiRZEzVOYHSaAcjLEQxnH8XnQBkK3ClcLs6aqwaUkvdm8WV3ZSv/XGa hP8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=stGzfXOi; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z10-20020a056a00240a00b0050d5fed6283si2743833pfh.161.2022.05.26.11.51.22; Thu, 26 May 2022 11:51:36 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=stGzfXOi; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346321AbiEZQXT (ORCPT + 99 others); Thu, 26 May 2022 12:23:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229780AbiEZQXR (ORCPT ); Thu, 26 May 2022 12:23:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0802E39B88; Thu, 26 May 2022 09:23:16 -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 586D161CDB; Thu, 26 May 2022 16:23:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BEFBC385A9; Thu, 26 May 2022 16:23:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653582195; bh=eMPfmFb/A6OibOFr1LhfCDVaZ7kXNdrZiwPUz7not2U=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=stGzfXOitW90ORa89P9NO9gAkafD0u2sPGd08KNMfQh0157WZS3vyCfSzZFcHeECg J3M8ZhaJnu8TVzSSsrf9CqNa9QvfA5QsjDZwyfwU3+5qeKeGbTgQcHfcmwkX+T0RYG YCQh9yqkYKbF7GQ3ZVPA7/EvnU7emb3l6brVHtG4ZqdYqZ7Poz6nxwwQEGp1Y8wbjD 0xZ4+2Hpl46XI36m8ml1dBXJ7YOybpdezDYnDwISrOELW7WI+vWXpy1FVBM04c3LVp ESAvc7nrHl7Xv0eH2lhtrl8QTwdAHcutb6eQLFK8B9EN0/p5WWPkDkxHwqXEe4Dmkq Zg21THhdrtsjw== Date: Thu, 26 May 2022 18:23:09 +0200 From: Marek =?UTF-8?B?QmVow7pu?= To: Miaoqian Lin Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] net: dsa: mv88e6xxx: Fix refcount leak in mv88e6xxx_mdios_register Message-ID: <20220526182309.2412106d@dellmb> In-Reply-To: <20220526145208.25673-1-linmq006@gmail.com> References: <20220526145208.25673-1-linmq006@gmail.com> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On Thu, 26 May 2022 18:52:08 +0400 Miaoqian Lin wrote: > of_get_child_by_name() returns a node pointer with refcount > incremented, we should use of_node_put() on it when done. >=20 > mv88e6xxx_mdio_register() pass the device node to of_mdiobus_register(). > We don't need the device node after it. >=20 > Add missing of_node_put() to avoid refcount leak. >=20 > Fixes: a3c53be55c95 ("net: dsa: mv88e6xxx: Support multiple MDIO busses") > Signed-off-by: Miaoqian Lin > --- > changes in v2: > - Add fixes tag. > changes in v3: > - Move of_node_put() statement to cover normal path. > - Update commit message. >=20 > I do cross-check to determine we should release the node after > of_mdiobus_register(), refer to functions like lan78xx_mdio_init(), > ave_init() and ag71xx_mdio_probe(). >=20 > v1 link: https://lore.kernel.org/r/20220526083748.39816-1-linmq006@gmail.= com/ > v2 link: https://lore.kernel.org/all/20220526112415.13835-1-linmq006@gmai= l.com/ > --- > drivers/net/dsa/mv88e6xxx/chip.c | 1 + > 1 file changed, 1 insertion(+) >=20 > diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx= /chip.c > index 5d2c57a7c708..0b49d243e00b 100644 > --- a/drivers/net/dsa/mv88e6xxx/chip.c > +++ b/drivers/net/dsa/mv88e6xxx/chip.c > @@ -3960,6 +3960,7 @@ static int mv88e6xxx_mdios_register(struct mv88e6xx= x_chip *chip, > */ > child =3D of_get_child_by_name(np, "mdio"); > err =3D mv88e6xxx_mdio_register(chip, child, false); > + of_node_put(child); > if (err) > return err; > =20 Reviewed-by: Marek Beh=C3=BAn