From: Miaoqian Lin Date: Thu, 29 Dec 2022 06:29:25 +0000 (+0400) Subject: net: phy: xgmiitorgmii: Fix refcount leak in xgmiitorgmii_probe X-Git-Tag: baikal/aarch64/sdk5.9~263 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=07fc5f5b8509a1ca47e7df4c4bb0a5889336764b;p=kernel.git net: phy: xgmiitorgmii: Fix refcount leak in xgmiitorgmii_probe [ Upstream commit d039535850ee47079d59527e96be18d8e0daa84b ] of_phy_find_device() return device node with refcount incremented. Call put_device() to relese it when not needed anymore. Fixes: 8e8c330ad34d ("net: phy: xgmiitorgmii: Check phy_driver ready before accessing") Signed-off-by: Miaoqian Lin Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c index 151c2a3f0b3a3..7a78dfdfa5bdd 100644 --- a/drivers/net/phy/xilinx_gmii2rgmii.c +++ b/drivers/net/phy/xilinx_gmii2rgmii.c @@ -82,6 +82,7 @@ static int xgmiitorgmii_probe(struct mdio_device *mdiodev) if (!priv->phy_dev->drv) { dev_info(dev, "Attached phy not ready\n"); + put_device(&priv->phy_dev->mdio.dev); return -EPROBE_DEFER; }