From: Russell King Date: Thu, 24 Sep 2015 19:36:23 +0000 (+0100) Subject: phy: fixed-phy: properly validate phy in fixed_phy_update_state() X-Git-Tag: v4.3-rc3~13^2~5^2~2 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=d618bf2bfd2a095644c852ebea16f5a981f9d875;p=karo-tx-linux.git phy: fixed-phy: properly validate phy in fixed_phy_update_state() 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 Signed-off-by: David S. Miller --- 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) {