[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZyDnp5hAii6rAu7a@hovoldconsulting.com>
Date: Tue, 29 Oct 2024 14:48:23 +0100
From: Johan Hovold <johan@...nel.org>
To: Zijun Hu <zijun_hu@...oud.com>
Cc: Vinod Koul <vkoul@...nel.org>,
Kishon Vijay Abraham I <kishon@...nel.org>,
Felipe Balbi <balbi@...com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Rob Herring <robh@...nel.org>, Arnd Bergmann <arnd@...db.de>,
Lee Jones <lee@...nel.org>,
Lorenzo Pieralisi <lpieralisi@...nel.org>,
Krzysztof WilczyĆski <kw@...ux.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
stable@...r.kernel.org, linux-phy@...ts.infradead.org,
linux-kernel@...r.kernel.org, Zijun Hu <quic_zijuhu@...cinc.com>
Subject: Re: [PATCH v2 5/6] phy: core: Fix an OF node refcount leakage in
of_phy_provider_lookup()
On Thu, Oct 24, 2024 at 10:39:30PM +0800, Zijun Hu wrote:
> From: Zijun Hu <quic_zijuhu@...cinc.com>
>
> For macro for_each_child_of_node(parent, child), refcount of @child has
> been increased before entering its loop body, so normally needs to call
> of_node_put(@child) before returning from the loop body to avoid refcount
> leakage.
>
> of_phy_provider_lookup() has such usage but does not call of_node_put()
> before returning, so cause leakage of the OF node refcount.
>
> Fixed by simply calling of_node_put() before returning from the loop body.
>
> The APIs affected by this issue are shown below since they indirectly
> invoke problematic of_phy_provider_lookup().
> phy_get()
> of_phy_get()
> devm_phy_get()
> devm_of_phy_get()
> devm_of_phy_get_by_index()
>
> Fixes: 2a4c37016ca9 ("phy: core: Fix of_phy_provider_lookup to return PHY provider for sub node")
> Cc: stable@...r.kernel.org
> Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>
Looks good.
Reviewed-by: Johan Hovold <johan+linaro@...nel.org>
Powered by blists - more mailing lists