From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Lunn Subject: Re: [PATCH 1/3] net: phy: Check phy_driver ready before accessing Date: Thu, 7 Jun 2018 18:52:27 +0200 Message-ID: <20180607165227.GD25513@lunn.ch> References: <20180607155348.149665-1-brandon.maier@rockwellcollins.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: netdev@vger.kernel.org, f.fainelli@gmail.com, davem@davemloft.net, michal.simek@xilinx.com, clayton.shotwell@rockwellcollins.com, kristopher.cory@rockwellcollins.com, linux-kernel@vger.kernel.org To: Brandon Maier Return-path: Content-Disposition: inline In-Reply-To: <20180607155348.149665-1-brandon.maier@rockwellcollins.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On Thu, Jun 07, 2018 at 10:53:46AM -0500, Brandon Maier wrote: > Since a phy_device is added to the global mdio_bus list during > phy_device_register(), but a phy_device's phy_driver doesn't get > attached until phy_probe(). It's possible of_phy_find_device() in > xgmiitorgmii will return a valid phy with a NULL phy_driver. Leading to > a NULL pointer access during the memcpy(). I'm sure there are more issues like this in the code. e.g. there is no attempt made to hold a reference to the child phy. So it could be unbound. priv->phy_drv->read_status(phydev) is then going to do bad things. Reviewed-by: Andrew Lunn Andrew