From: Rosen Penev <rosenp@gmail.com>
To: netdev@vger.kernel.org
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Wolfgang Grandegger <wg@grandegger.com>,
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH net] net: emac: guard PHY bitmap teardown
Date: Tue, 20 Oct 2026 15:27:23 -0700 [thread overview]
Message-ID: <20261020222723.1746201-1-rosenp@gmail.com> (raw)
PHY-less and fixed-link configurations retain a negative PHY address.
Avoid shifting by that value while removing the device, and serialize the
bitmap update with PHY discovery.
Fixes: d6f144830bdf ("ibm/emac: fix improper cleanup when device is removed to allow re-bind")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/net/ethernet/ibm/emac/core.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c
index 4124a90b18c4..0f534af2f3de 100644
--- a/drivers/net/ethernet/ibm/emac/core.c
+++ b/drivers/net/ethernet/ibm/emac/core.c
@@ -3240,8 +3240,11 @@ static void emac_remove(struct platform_device *ofdev)
if (emac_has_feature(dev, EMAC_FTR_HAS_ZMII))
zmii_detach(dev->zmii_dev, dev->zmii_port);
- busy_phy_map &= ~(1 << dev->phy.address);
+ mutex_lock(&emac_phy_map_lock);
+ if (dev->phy.address >= 0 && dev->phy.address < 32)
+ busy_phy_map &= ~BIT(dev->phy.address);
DBG(dev, "busy_phy_map now %#x" NL, busy_phy_map);
+ mutex_unlock(&emac_phy_map_lock);
mal_unregister_commac(dev->mal, &dev->commac);
emac_put_deps(dev);
--
2.56.0
next reply other threads:[~2026-10-20 22:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-20 22:27 Rosen Penev [this message]
2026-10-20 22:33 ` [PATCH net] net: emac: guard PHY bitmap teardown netdev-bot+sinfo
2026-10-20 22:38 ` Rosen Penev
2026-10-21 0:50 ` Andrew Lunn
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=20261020222723.1746201-1-rosenp@gmail.com \
--to=rosenp@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=wg@grandegger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.