From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Lunn Subject: Re: [PATCH net v3] net: phy: mscc: fix deadlock in vsc85xx_default_config Date: Fri, 23 Nov 2018 19:03:58 +0100 Message-ID: <20181123180358.GC5273@lunn.ch> References: <20181123180151.14183-1-quentin.schulz@bootlin.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: davem@davemloft.net, f.fainelli@gmail.com, allan.nielsen@microchip.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, thomas.petazzoni@bootlin.com, alexandre.belloni@bootlin.com To: Quentin Schulz Return-path: Content-Disposition: inline In-Reply-To: <20181123180151.14183-1-quentin.schulz@bootlin.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On Fri, Nov 23, 2018 at 07:01:51PM +0100, Quentin Schulz wrote: > The vsc85xx_default_config function called in the vsc85xx_config_init > function which is used by VSC8530, VSC8531, VSC8540 and VSC8541 PHYs > mistakenly calls phy_read and phy_write in-between phy_select_page and > phy_restore_page. > > phy_select_page and phy_restore_page actually take and release the MDIO > bus lock and phy_write and phy_read take and release the lock to write > or read to a PHY register. > > Let's fix this deadlock by using phy_modify_paged which handles > correctly a read followed by a write in a non-standard page. > > Fixes: 6a0bfbbe20b0 ("net: phy: mscc: migrate to phy_select/restore_page functions") > > Signed-off-by: Quentin Schulz Reviewed-by: Andrew Lunn Andrew