From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 695886FA0 for ; Mon, 16 Jan 2023 16:57:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7D5BC433D2; Mon, 16 Jan 2023 16:57:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673888224; bh=YaAwqQ9LeaF8qeqn3JoEgZv8J/Bg1A0eXgbcQDM1Lug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j58WtiAt/PspV2DPJE4rJ5pRzmGgEXwioCoOKMVeWDXA/jj2+1hwc+I5NTOAhEHpR jpyK7QGMbvTDvxzuOVh98d8XqUD91Ax5FXKzwj+DPJWaMoD3baeBzGc3zpbyq38t3e 2WkIykQAJij5Fa0lFcvTpa/oma0luopasWk2Z5bw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Miaoqian Lin , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 447/521] net: phy: xgmiitorgmii: Fix refcount leak in xgmiitorgmii_probe Date: Mon, 16 Jan 2023 16:51:49 +0100 Message-Id: <20230116154907.132217474@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116154847.246743274@linuxfoundation.org> References: <20230116154847.246743274@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Miaoqian Lin [ Upstream commit d039535850ee47079d59527e96be18d8e0daa84b ] of_phy_find_device() return device node with refcount incremented. Call put_device() to relese it when not needed anymore. Fixes: ab4e6ee578e8 ("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 --- drivers/net/phy/xilinx_gmii2rgmii.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c index bd6084e315de..f44dc80ed3e6 100644 --- a/drivers/net/phy/xilinx_gmii2rgmii.c +++ b/drivers/net/phy/xilinx_gmii2rgmii.c @@ -91,6 +91,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; } -- 2.35.1