From: Andrew Lunn <andrew@lunn.ch>
To: Serge Semin <fancer.lancer@gmail.com>
Cc: Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Francesco Dolcini <francesco.dolcini@toradex.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net: phy: Fix deadlocking in phy_error() invocation
Date: Fri, 18 Aug 2023 15:07:49 +0200 [thread overview]
Message-ID: <6e52f88e-73ad-4e2a-90ca-ada471f30b9d@lunn.ch> (raw)
In-Reply-To: <20230818125449.32061-1-fancer.lancer@gmail.com>
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
next prev parent reply other threads:[~2023-08-18 13:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-18 12:54 Serge Semin
2023-08-18 13:07 ` Andrew Lunn [this message]
2023-08-18 14:27 ` Serge Semin
2023-08-18 15:32 ` Andrew Lunn
2023-08-19 18:34 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6e52f88e-73ad-4e2a-90ca-ada471f30b9d@lunn.ch \
--to=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fancer.lancer@gmail.com \
--cc=francesco.dolcini@toradex.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®