Messages in this thread | | | Date | Fri, 18 Aug 2023 15:07:49 +0200 | From | Andrew Lunn <> | Subject | Re: [PATCH net] net: phy: Fix deadlocking in phy_error() invocation |
| |
On Fri, Aug 18, 2023 at 03:54:45PM +0300, Serge Semin wrote: > static void phy_process_error(struct phy_device *phydev) > { > - mutex_lock(&phydev->lock); > + /* phydev->lock must be held for the state change to be safe */ > + if (!mutex_is_locked(&phydev->lock)) > + phydev_err(phydev, "PHY-device data unsafe context\n"); > + > phydev->state = PHY_ERROR; > - mutex_unlock(&phydev->lock); > > phy_trigger_machine(phydev); > }
Thanks for the patch Serge. It looks like a good implementation of what i suggested. But thinking about it further, if the error ever appears in somebodies kernel log, there is probably not enough information to actually fix it. There is no call path. So i think it should actually use WARN_ON_ONCE() so we get a stack trace.
Sorry for changing my mind.
Andrew
--- pw-bot: cr
| |