From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from pandora.arm.linux.org.uk (pandora.arm.linux.org.uk [IPv6:2001:4d48:ad52:3201:214:fdff:fe10:1be6]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id BFF571A073D for ; Fri, 25 Sep 2015 05:37:35 +1000 (AEST) In-Reply-To: <20150922161710.GA21084@n2100.arm.linux.org.uk> References: <20150922161710.GA21084@n2100.arm.linux.org.uk> From: Russell King To: Florian Fainelli , David Miller Cc: devicetree@vger.kernel.org, Frank Rowand , Grant Likely , Iyappan Subramanian , Keyur Chudgar , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Li Yang , Michal Simek , netdev@vger.kernel.org, Robert Richter , Rob Herring , "Soren Brinkmann" , Sunil Goutham , Thomas Petazzoni , linux-kernel@vger.kernel.org Subject: [PATCH RESEND v3 7/9] phy: fixed-phy: properly validate phy in fixed_phy_update_state() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Message-Id: Sender: Russell King Date: Thu, 24 Sep 2015 20:36:23 +0100 List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Validate that the phy_device passed into fixed_phy_update_state() is a fixed-phy device before walking the list of phys for a fixed phy at the same address. Signed-off-by: Russell King --- drivers/net/phy/fixed_phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c index fb1299c6326e..e23bf5b90e17 100644 --- a/drivers/net/phy/fixed_phy.c +++ b/drivers/net/phy/fixed_phy.c @@ -220,7 +220,7 @@ int fixed_phy_update_state(struct phy_device *phydev, struct fixed_mdio_bus *fmb = &platform_fmb; struct fixed_phy *fp; - if (!phydev || !phydev->bus) + if (!phydev || phydev->bus != fmb->mii_bus) return -EINVAL; list_for_each_entry(fp, &fmb->phys, node) { -- 2.1.0