mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net 00/10] net: Move setting of netops to fix crash
@ 2026-10-08  2:26 David Yang
  2026-10-08  2:26 ` [PATCH net 01/10] net: hisilicon: hisi_femac: " David Yang
                   ` (10 more replies)
  0 siblings, 11 replies; 26+ messages in thread
From: David Yang @ 2026-10-08  2:26 UTC (permalink / raw)
  To: netdev
  Cc: David Yang, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Andreas Färber,
	Manivannan Sadhasivam, Ciprian Regus, Andreas Larsson, Jian Shen,
	Jijie Shao, Sebastian Hesselbarth, Parthiban Veerasooran,
	MD Danish Anwar, Parvathi Pudi, Roger Quadros,
	Mohan Reddy Putluru, Runyu Xiao, Simon Horman, Jacob Keller,
	Stanislav Fomichev, Nicolai Buchwitz, Maxime Chevallier,
	linux-arm-kernel, linux-actions, linux-kernel

Commit ded86da4bbb7 ("net: ethtool: relax ethnl_req_get_phydev()
locking assertion") put a netdev_need_ops_lock() check on the
phy_attach_direct() path, in phy_link_topo_add_phy(). With
CONFIG_NET_SHAPER enabled netdev_need_ops_lock() reads
dev->netdev_ops->net_shaper_ops, so any driver that connects a PHY
before assigning ndev->netdev_ops now dies with a NULL pointer
dereference at probe time. The breakage showed up in v7.3-rc1.

ibm/emac was hit first and fixed by commit 7c9f391ec89c ("net: emac:
move setting of netops to fix crash"). These ten patches apply the
same one-line move to the remaining in-tree drivers whose probe path
attaches a PHY before filling in netdev_ops:

  1. hisilicon/hisi_femac   (crash reproduced on hardware)
  2. hisilicon/hip04
  3. actions/owl-emac
  4. adi/adin1140
  5. marvell/mv643xx_eth
  6. amd/au1000_eth
  7. ethoc
  8. aeroflex/greth
  9. ti/icssm-prueth
 10. microchip/lan865x      (attach happens inside oa_tc6_init())

Only patch 1 was reproduced and verified on hardware; patches 2-10
were found by source inspection and are neither build nor boot
tested.

Note that ti/netcp_ethss and cavium/thunder_bgx attach a PHY to
netdevs that never get a netdev_ops at all (dummy netdevs), so they
cannot be fixed by reordering and are not addressed here.

David Yang (10):
  net: hisilicon: hisi_femac: Move setting of netops to fix crash
  net: hisilicon: hip04_eth: Move setting of netops to fix crash
  net: ethernet: actions: Move setting of netops to fix crash
  net: ethernet: adi: Move setting of netops to fix crash
  net: mv643xx: move setting of netops to fix crash
  net: au1000: move setting of netops to fix crash
  net: ethoc: move setting of netops to fix crash
  net: ethernet: aeroflex: move setting of netops to fix crash
  net: ti: icssm-prueth: Move setting of netops to fix crash
  microchip: lan865x: move setting of netops to fix crash

 drivers/net/ethernet/actions/owl-emac.c          | 3 ++-
 drivers/net/ethernet/adi/adin1140.c              | 3 ++-
 drivers/net/ethernet/aeroflex/greth.c            | 3 ++-
 drivers/net/ethernet/amd/au1000_eth.c            | 3 ++-
 drivers/net/ethernet/ethoc.c                     | 3 ++-
 drivers/net/ethernet/hisilicon/hip04_eth.c       | 3 ++-
 drivers/net/ethernet/hisilicon/hisi_femac.c      | 3 ++-
 drivers/net/ethernet/marvell/mv643xx_eth.c       | 4 ++--
 drivers/net/ethernet/microchip/lan865x/lan865x.c | 3 ++-
 drivers/net/ethernet/ti/icssm/icssm_prueth.c     | 3 ++-
 10 files changed, 20 insertions(+), 11 deletions(-)

-- 
2.53.0


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH net 01/10] net: hisilicon: hisi_femac: Move setting of netops to fix crash
  2026-10-08  2:26 [PATCH net 00/10] net: Move setting of netops to fix crash David Yang
@ 2026-10-08  2:26 ` David Yang
  2026-10-08  8:29   ` Maxime Chevallier
  2026-10-08 11:51   ` Jijie Shao
  2026-10-08  2:26 ` [PATCH net 02/10] net: hisilicon: hip04_eth: " David Yang
                   ` (9 subsequent siblings)
  10 siblings, 2 replies; 26+ messages in thread
From: David Yang @ 2026-10-08  2:26 UTC (permalink / raw)
  To: netdev
  Cc: David Yang, Jian Shen, Jijie Shao, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Nicolai Buchwitz,
	Maxime Chevallier, Stanislav Fomichev, linux-kernel

hisi_femac_drv_probe() connects the PHY before dev->netdev_ops is
assigned. phy_attach_direct() -> phy_link_topo_add_phy() reads
dev->netdev_ops through netdev_need_ops_lock() since the commit in
question, so probing crashes with a NULL pointer dereference when
CONFIG_NET_SHAPER is enabled.

  phy_link_topo_add_phy from phy_attach_direct+0xec/0x37c
  of_phy_get_and_connect from hisi_femac_drv_probe+0x1f4/0x558
  Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

Assign netdev_ops before the PHY attach, as was done for emac in commit
7c9f391ec89c ("net: emac: move setting of netops to fix crash").

Fixes: ded86da4bbb7 ("net: ethtool: relax ethnl_req_get_phydev() locking assertion")
Signed-off-by: David Yang <mmyangfl@gmail.com>
---
 drivers/net/ethernet/hisilicon/hisi_femac.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hisi_femac.c b/drivers/net/ethernet/hisilicon/hisi_femac.c
index d244a40df430..016605e86f0b 100644
--- a/drivers/net/ethernet/hisilicon/hisi_femac.c
+++ b/drivers/net/ethernet/hisilicon/hisi_femac.c
@@ -830,6 +830,8 @@ static int hisi_femac_drv_probe(struct platform_device *pdev)
 		hisi_femac_phy_reset(priv);
 	}
 
+	ndev->netdev_ops = &hisi_femac_netdev_ops;
+
 	phy = of_phy_get_and_connect(ndev, node, hisi_femac_adjust_link);
 	if (!phy) {
 		dev_err(dev, "connect to PHY failed!\n");
@@ -850,7 +852,6 @@ static int hisi_femac_drv_probe(struct platform_device *pdev)
 
 	ndev->watchdog_timeo = 6 * HZ;
 	ndev->priv_flags |= IFF_UNICAST_FLT;
-	ndev->netdev_ops = &hisi_femac_netdev_ops;
 	ndev->ethtool_ops = &hisi_femac_ethtools_ops;
 	netif_napi_add_weight(ndev, &priv->napi, hisi_femac_poll,
 			      FEMAC_POLL_WEIGHT);
-- 
2.53.0


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH net 02/10] net: hisilicon: hip04_eth: Move setting of netops to fix crash
  2026-10-08  2:26 [PATCH net 00/10] net: Move setting of netops to fix crash David Yang
  2026-10-08  2:26 ` [PATCH net 01/10] net: hisilicon: hisi_femac: " David Yang
@ 2026-10-08  2:26 ` David Yang
  2026-10-08  8:30   ` Maxime Chevallier
  2026-10-08  2:26 ` [PATCH net 03/10] net: ethernet: actions: " David Yang
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 26+ messages in thread
From: David Yang @ 2026-10-08  2:26 UTC (permalink / raw)
  To: netdev
  Cc: David Yang, Jian Shen, Jijie Shao, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Jacob Keller,
	Nicolai Buchwitz, Stanislav Fomichev, Maxime Chevallier,
	linux-kernel

hip04_mac_probe() calls of_phy_connect() before ndev->netdev_ops is
assigned. phy_attach_direct() -> phy_link_topo_add_phy() reads
dev->netdev_ops through netdev_need_ops_lock() since the commit in
question, so probing crashes with a NULL pointer dereference when
CONFIG_NET_SHAPER is enabled.

Assign netdev_ops before the PHY attach, as was done for emac in commit
7c9f391ec89c ("net: emac: move setting of netops to fix crash").

Fixes: ded86da4bbb7 ("net: ethtool: relax ethnl_req_get_phydev() locking assertion")
Signed-off-by: David Yang <mmyangfl@gmail.com>
---
 drivers/net/ethernet/hisilicon/hip04_eth.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c
index fc2c47dcfaab..d0409de5c553 100644
--- a/drivers/net/ethernet/hisilicon/hip04_eth.c
+++ b/drivers/net/ethernet/hisilicon/hip04_eth.c
@@ -976,6 +976,8 @@ static int hip04_mac_probe(struct platform_device *pdev)
 		goto init_fail;
 	}
 
+	ndev->netdev_ops = &hip04_netdev_ops;
+
 	priv->phy_node = of_parse_phandle(node, "phy-handle", 0);
 	if (priv->phy_node) {
 		priv->phy = of_phy_connect(ndev, priv->phy_node,
@@ -989,7 +991,6 @@ static int hip04_mac_probe(struct platform_device *pdev)
 
 	INIT_WORK(&priv->tx_timeout_task, hip04_tx_timeout_task);
 
-	ndev->netdev_ops = &hip04_netdev_ops;
 	ndev->ethtool_ops = &hip04_ethtool_ops;
 	ndev->watchdog_timeo = TX_TIMEOUT;
 	ndev->priv_flags |= IFF_UNICAST_FLT;
-- 
2.53.0


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH net 03/10] net: ethernet: actions: Move setting of netops to fix crash
  2026-10-08  2:26 [PATCH net 00/10] net: Move setting of netops to fix crash David Yang
  2026-10-08  2:26 ` [PATCH net 01/10] net: hisilicon: hisi_femac: " David Yang
  2026-10-08  2:26 ` [PATCH net 02/10] net: hisilicon: hip04_eth: " David Yang
@ 2026-10-08  2:26 ` David Yang
  2026-10-08  8:30   ` Maxime Chevallier
  2026-10-08  2:26 ` [PATCH net 04/10] net: ethernet: adi: " David Yang
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 26+ messages in thread
From: David Yang @ 2026-10-08  2:26 UTC (permalink / raw)
  To: netdev
  Cc: David Yang, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Andreas Färber,
	Manivannan Sadhasivam, Stanislav Fomichev, Maxime Chevallier,
	Nicolai Buchwitz, Jacob Keller, linux-arm-kernel, linux-actions,
	linux-kernel

owl_emac_probe() calls owl_emac_phy_init(), which connects the PHY,
before netdev->netdev_ops is assigned. phy_attach_direct() ->
phy_link_topo_add_phy() reads dev->netdev_ops through
netdev_need_ops_lock() since the commit in question, so probing crashes
with a NULL pointer dereference when CONFIG_NET_SHAPER is enabled.

Assign netdev_ops before the PHY attach, as was done for emac in commit
7c9f391ec89c ("net: emac: move setting of netops to fix crash").

Fixes: ded86da4bbb7 ("net: ethtool: relax ethnl_req_get_phydev() locking assertion")
Signed-off-by: David Yang <mmyangfl@gmail.com>
---
 drivers/net/ethernet/actions/owl-emac.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/actions/owl-emac.c b/drivers/net/ethernet/actions/owl-emac.c
index 0a08da799255..2538275a1e57 100644
--- a/drivers/net/ethernet/actions/owl-emac.c
+++ b/drivers/net/ethernet/actions/owl-emac.c
@@ -1552,6 +1552,8 @@ static int owl_emac_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	netdev->netdev_ops = &owl_emac_netdev_ops;
+
 	ret = owl_emac_phy_init(netdev);
 	if (ret) {
 		dev_err(dev, "failed to initialize PHY\n");
@@ -1563,7 +1565,6 @@ static int owl_emac_probe(struct platform_device *pdev)
 	netdev->min_mtu = OWL_EMAC_MTU_MIN;
 	netdev->max_mtu = OWL_EMAC_MTU_MAX;
 	netdev->watchdog_timeo = OWL_EMAC_TX_TIMEOUT;
-	netdev->netdev_ops = &owl_emac_netdev_ops;
 	netdev->ethtool_ops = &owl_emac_ethtool_ops;
 	netif_napi_add(netdev, &priv->napi, owl_emac_poll);
 
-- 
2.53.0


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH net 04/10] net: ethernet: adi: Move setting of netops to fix crash
  2026-10-08  2:26 [PATCH net 00/10] net: Move setting of netops to fix crash David Yang
                   ` (2 preceding siblings ...)
  2026-10-08  2:26 ` [PATCH net 03/10] net: ethernet: actions: " David Yang
@ 2026-10-08  2:26 ` David Yang
  2026-10-08  8:30   ` Maxime Chevallier
  2026-10-09 13:03   ` Regus, Ciprian
  2026-10-08  2:26 ` [PATCH net 05/10] net: mv643xx: move " David Yang
                   ` (6 subsequent siblings)
  10 siblings, 2 replies; 26+ messages in thread
From: David Yang @ 2026-10-08  2:26 UTC (permalink / raw)
  To: netdev
  Cc: David Yang, Ciprian Regus, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Stanislav Fomichev,
	Nicolai Buchwitz, Maxime Chevallier, linux-kernel

adin1140_probe() calls adin1140_phy_init(), which connects the PHY,
before netdev->netdev_ops is assigned. phy_attach_direct() ->
phy_link_topo_add_phy() reads dev->netdev_ops through
netdev_need_ops_lock() since the commit in question, so probing crashes
with a NULL pointer dereference when CONFIG_NET_SHAPER is enabled.

Assign netdev_ops before the PHY attach, as was done for emac in commit
7c9f391ec89c ("net: emac: move setting of netops to fix crash").

Fixes: ded86da4bbb7 ("net: ethtool: relax ethnl_req_get_phydev() locking assertion")
Signed-off-by: David Yang <mmyangfl@gmail.com>
---
 drivers/net/ethernet/adi/adin1140.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/adi/adin1140.c b/drivers/net/ethernet/adi/adin1140.c
index 93710baca151..ca96a919c24b 100644
--- a/drivers/net/ethernet/adi/adin1140.c
+++ b/drivers/net/ethernet/adi/adin1140.c
@@ -733,6 +733,8 @@ static int adin1140_probe(struct spi_device *spi)
 	if (ret)
 		return ret;
 
+	netdev->netdev_ops = &adin1140_netdev_ops;
+
 	ret = adin1140_phy_init(priv, spi);
 	if (ret)
 		return ret;
@@ -748,7 +750,6 @@ static int adin1140_probe(struct spi_device *spi)
 
 	netdev->if_port = IF_PORT_10BASET;
 	netdev->irq = spi->irq;
-	netdev->netdev_ops = &adin1140_netdev_ops;
 	netdev->ethtool_ops = &adin1140_ethtool_ops;
 	netdev->netns_immutable = true;
 	netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE |
-- 
2.53.0


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH net 05/10] net: mv643xx: move setting of netops to fix crash
  2026-10-08  2:26 [PATCH net 00/10] net: Move setting of netops to fix crash David Yang
                   ` (3 preceding siblings ...)
  2026-10-08  2:26 ` [PATCH net 04/10] net: ethernet: adi: " David Yang
@ 2026-10-08  2:26 ` David Yang
  2026-10-13 10:00   ` Daniel Machon
  2026-10-08  2:26 ` [PATCH net 06/10] net: au1000: " David Yang
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 26+ messages in thread
From: David Yang @ 2026-10-08  2:26 UTC (permalink / raw)
  To: netdev
  Cc: David Yang, Sebastian Hesselbarth, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Stanislav Fomichev,
	Nicolai Buchwitz, Jacob Keller, linux-kernel

mv643xx_eth_probe() connects the PHY before dev->netdev_ops is
assigned. phy_attach_direct() -> phy_link_topo_add_phy() reads
dev->netdev_ops through netdev_need_ops_lock() since the commit in
question, so probing crashes with a NULL pointer dereference when
CONFIG_NET_SHAPER is enabled.

Assign netdev_ops before the PHY attach, as was done for emac in commit
7c9f391ec89c ("net: emac: move setting of netops to fix crash").

Fixes: ded86da4bbb7 ("net: ethtool: relax ethnl_req_get_phydev() locking assertion")
Signed-off-by: David Yang <mmyangfl@gmail.com>
---
 drivers/net/ethernet/marvell/mv643xx_eth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 9caa1e47c174..38b4d65f58a5 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -3171,6 +3171,8 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
 	netif_set_real_num_tx_queues(dev, mp->txq_count);
 	netif_set_real_num_rx_queues(dev, mp->rxq_count);
 
+	dev->netdev_ops = &mv643xx_eth_netdev_ops;
+
 	err = 0;
 	if (pd->phy_node) {
 		phydev = of_phy_connect(mp->dev, pd->phy_node,
@@ -3221,8 +3223,6 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
 	}
 	dev->irq = irq;
 
-	dev->netdev_ops = &mv643xx_eth_netdev_ops;
-
 	dev->watchdog_timeo = 2 * HZ;
 	dev->base_addr = 0;
 
-- 
2.53.0


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH net 06/10] net: au1000: move setting of netops to fix crash
  2026-10-08  2:26 [PATCH net 00/10] net: Move setting of netops to fix crash David Yang
                   ` (4 preceding siblings ...)
  2026-10-08  2:26 ` [PATCH net 05/10] net: mv643xx: move " David Yang
@ 2026-10-08  2:26 ` David Yang
  2026-10-08  8:31   ` Maxime Chevallier
  2026-10-08  2:26 ` [PATCH net 07/10] net: ethoc: " David Yang
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 26+ messages in thread
From: David Yang @ 2026-10-08  2:26 UTC (permalink / raw)
  To: netdev
  Cc: David Yang, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Runyu Xiao, Simon Horman,
	Jacob Keller, Nicolai Buchwitz, Maxime Chevallier, linux-kernel

au1000_probe() calls au1000_mii_probe(), which connects the PHY,
before dev->netdev_ops is assigned. phy_attach_direct() ->
phy_link_topo_add_phy() reads dev->netdev_ops through
netdev_need_ops_lock() since the commit in question, so probing crashes
with a NULL pointer dereference when CONFIG_NET_SHAPER is enabled.

Assign netdev_ops before the PHY attach, as was done for emac in commit
7c9f391ec89c ("net: emac: move setting of netops to fix crash").

Fixes: ded86da4bbb7 ("net: ethtool: relax ethnl_req_get_phydev() locking assertion")
Signed-off-by: David Yang <mmyangfl@gmail.com>
---
 drivers/net/ethernet/amd/au1000_eth.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/amd/au1000_eth.c b/drivers/net/ethernet/amd/au1000_eth.c
index 5a04056e38fa..8682323d693f 100644
--- a/drivers/net/ethernet/amd/au1000_eth.c
+++ b/drivers/net/ethernet/amd/au1000_eth.c
@@ -1225,6 +1225,8 @@ static int au1000_probe(struct platform_device *pdev)
 		goto err_mdiobus_reg;
 	}
 
+	dev->netdev_ops = &au1000_netdev_ops;
+
 	err = au1000_mii_probe(dev);
 	if (err != 0)
 		goto err_out;
@@ -1263,7 +1265,6 @@ static int au1000_probe(struct platform_device *pdev)
 
 	dev->base_addr = base->start;
 	dev->irq = irq;
-	dev->netdev_ops = &au1000_netdev_ops;
 	dev->ethtool_ops = &au1000_ethtool_ops;
 	dev->watchdog_timeo = ETH_TX_TIMEOUT;
 
-- 
2.53.0


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH net 07/10] net: ethoc: move setting of netops to fix crash
  2026-10-08  2:26 [PATCH net 00/10] net: Move setting of netops to fix crash David Yang
                   ` (5 preceding siblings ...)
  2026-10-08  2:26 ` [PATCH net 06/10] net: au1000: " David Yang
@ 2026-10-08  2:26 ` David Yang
  2026-10-08  8:31   ` Maxime Chevallier
  2026-10-13 10:00   ` Daniel Machon
  2026-10-08  2:26 ` [PATCH net 08/10] net: ethernet: aeroflex: " David Yang
                   ` (3 subsequent siblings)
  10 siblings, 2 replies; 26+ messages in thread
From: David Yang @ 2026-10-08  2:26 UTC (permalink / raw)
  To: netdev
  Cc: David Yang, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Maxime Chevallier,
	Stanislav Fomichev, Jacob Keller, linux-kernel

ethoc_probe() calls ethoc_mdio_probe(), which connects the PHY,
before netdev->netdev_ops is assigned. phy_attach_direct() ->
phy_link_topo_add_phy() reads dev->netdev_ops through
netdev_need_ops_lock() since the commit in question, so probing crashes
with a NULL pointer dereference when CONFIG_NET_SHAPER is enabled.

Assign netdev_ops before the PHY attach, as was done for emac in commit
7c9f391ec89c ("net: emac: move setting of netops to fix crash").

Fixes: ded86da4bbb7 ("net: ethtool: relax ethnl_req_get_phydev() locking assertion")
Signed-off-by: David Yang <mmyangfl@gmail.com>
---
 drivers/net/ethernet/ethoc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c
index 0c418557264c..e5b7df43e8f6 100644
--- a/drivers/net/ethernet/ethoc.c
+++ b/drivers/net/ethernet/ethoc.c
@@ -1211,6 +1211,8 @@ static int ethoc_probe(struct platform_device *pdev)
 		goto free3;
 	}
 
+	netdev->netdev_ops = &ethoc_netdev_ops;
+
 	ret = ethoc_mdio_probe(netdev);
 	if (ret) {
 		dev_err(&netdev->dev, "failed to probe MDIO bus\n");
@@ -1218,7 +1220,6 @@ static int ethoc_probe(struct platform_device *pdev)
 	}
 
 	/* setup the net_device structure */
-	netdev->netdev_ops = &ethoc_netdev_ops;
 	netdev->watchdog_timeo = ETHOC_TIMEOUT;
 	netdev->features |= 0;
 	netdev->ethtool_ops = &ethoc_ethtool_ops;
-- 
2.53.0


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH net 08/10] net: ethernet: aeroflex: move setting of netops to fix crash
  2026-10-08  2:26 [PATCH net 00/10] net: Move setting of netops to fix crash David Yang
                   ` (6 preceding siblings ...)
  2026-10-08  2:26 ` [PATCH net 07/10] net: ethoc: " David Yang
@ 2026-10-08  2:26 ` David Yang
  2026-10-08  8:31   ` Maxime Chevallier
  2026-10-09 14:34   ` Andreas Larsson
  2026-10-08  2:26 ` [PATCH net 09/10] net: ti: icssm-prueth: Move " David Yang
                   ` (2 subsequent siblings)
  10 siblings, 2 replies; 26+ messages in thread
From: David Yang @ 2026-10-08  2:26 UTC (permalink / raw)
  To: netdev
  Cc: David Yang, Andreas Larsson, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Chevallier,
	Jacob Keller, Stanislav Fomichev, linux-kernel

greth_of_probe() calls greth_mdio_init(), which connects the PHY,
before dev->netdev_ops is assigned. phy_attach_direct() ->
phy_link_topo_add_phy() reads dev->netdev_ops through
netdev_need_ops_lock() since the commit in question, so probing crashes
with a NULL pointer dereference when CONFIG_NET_SHAPER is enabled.

Assign netdev_ops before the PHY attach, as was done for emac in commit
7c9f391ec89c ("net: emac: move setting of netops to fix crash").

Fixes: ded86da4bbb7 ("net: ethtool: relax ethnl_req_get_phydev() locking assertion")
Signed-off-by: David Yang <mmyangfl@gmail.com>
---
 drivers/net/ethernet/aeroflex/greth.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c
index a593adc16c78..fccb67beebee 100644
--- a/drivers/net/ethernet/aeroflex/greth.c
+++ b/drivers/net/ethernet/aeroflex/greth.c
@@ -1421,6 +1421,8 @@ static int greth_of_probe(struct platform_device *ofdev)
 	/* Check if MAC can handle MDIO interrupts */
 	greth->mdio_int_en = (tmp >> 26) & 1;
 
+	dev->netdev_ops = &greth_netdev_ops;
+
 	err = greth_mdio_init(greth);
 	if (err) {
 		if (netif_msg_probe(greth))
@@ -1498,7 +1500,6 @@ static int greth_of_probe(struct platform_device *ofdev)
 		dev->flags &= ~IFF_MULTICAST;
 	}
 
-	dev->netdev_ops = &greth_netdev_ops;
 	dev->ethtool_ops = &greth_ethtool_ops;
 
 	err = register_netdev(dev);
-- 
2.53.0


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH net 09/10] net: ti: icssm-prueth: Move setting of netops to fix crash
  2026-10-08  2:26 [PATCH net 00/10] net: Move setting of netops to fix crash David Yang
                   ` (7 preceding siblings ...)
  2026-10-08  2:26 ` [PATCH net 08/10] net: ethernet: aeroflex: " David Yang
@ 2026-10-08  2:26 ` David Yang
  2026-10-08  8:32   ` Maxime Chevallier
  2026-10-08  2:26 ` [PATCH net 10/10] microchip: lan865x: move " David Yang
  2026-10-08 12:10 ` [PATCH net 00/10] net: Move " Jijie Shao
  10 siblings, 1 reply; 26+ messages in thread
From: David Yang @ 2026-10-08  2:26 UTC (permalink / raw)
  To: netdev
  Cc: David Yang, MD Danish Anwar, Parvathi Pudi, Roger Quadros,
	Mohan Reddy Putluru, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Jacob Keller, Stanislav Fomichev,
	Nicolai Buchwitz, Maxime Chevallier, linux-arm-kernel,
	linux-kernel

icssm_prueth_netdev_init() calls of_phy_get_and_connect() before
ndev->netdev_ops is assigned. phy_attach_direct() ->
phy_link_topo_add_phy() reads dev->netdev_ops through
netdev_need_ops_lock() since the commit in question, so probing crashes
with a NULL pointer dereference when CONFIG_NET_SHAPER is enabled.

Assign netdev_ops before the PHY attach, as was done for emac in commit
7c9f391ec89c ("net: emac: move setting of netops to fix crash").

Fixes: ded86da4bbb7 ("net: ethtool: relax ethnl_req_get_phydev() locking assertion")
Signed-off-by: David Yang <mmyangfl@gmail.com>
---
 drivers/net/ethernet/ti/icssm/icssm_prueth.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ti/icssm/icssm_prueth.c b/drivers/net/ethernet/ti/icssm/icssm_prueth.c
index b7e94244355a..b42c98e861e0 100644
--- a/drivers/net/ethernet/ti/icssm/icssm_prueth.c
+++ b/drivers/net/ethernet/ti/icssm/icssm_prueth.c
@@ -1563,6 +1563,8 @@ static int icssm_prueth_netdev_init(struct prueth *prueth,
 	}
 	ether_addr_copy(emac->mac_addr, ndev->dev_addr);
 
+	ndev->netdev_ops = &emac_netdev_ops;
+
 	/* connect PHY */
 	emac->phydev = of_phy_get_and_connect(ndev, eth_node,
 					      icssm_emac_adjust_link);
@@ -1590,7 +1592,6 @@ static int icssm_prueth_netdev_init(struct prueth *prueth,
 	}
 
 	ndev->dev.of_node = eth_node;
-	ndev->netdev_ops = &emac_netdev_ops;
 
 	netif_napi_add(ndev, &emac->napi, icssm_emac_napi_poll);
 
-- 
2.53.0


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH net 10/10] microchip: lan865x: move setting of netops to fix crash
  2026-10-08  2:26 [PATCH net 00/10] net: Move setting of netops to fix crash David Yang
                   ` (8 preceding siblings ...)
  2026-10-08  2:26 ` [PATCH net 09/10] net: ti: icssm-prueth: Move " David Yang
@ 2026-10-08  2:26 ` David Yang
  2026-10-08  8:32   ` Maxime Chevallier
  2026-10-08 12:10 ` [PATCH net 00/10] net: Move " Jijie Shao
  10 siblings, 1 reply; 26+ messages in thread
From: David Yang @ 2026-10-08  2:26 UTC (permalink / raw)
  To: netdev
  Cc: David Yang, Parthiban Veerasooran, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Nicolai Buchwitz,
	Maxime Chevallier, Jacob Keller, linux-kernel

lan865x_probe() assigns netdev_ops only after oa_tc6_init(), which
connects the internal MAC-PHY through phy_connect_direct().
phy_attach_direct() -> phy_link_topo_add_phy() reads dev->netdev_ops
through netdev_need_ops_lock() since the commit in question, so probing
crashes with a NULL pointer dereference when CONFIG_NET_SHAPER is
enabled.

Assign netdev_ops before the PHY attach, as was done for emac in commit
7c9f391ec89c ("net: emac: move setting of netops to fix crash").

Fixes: ded86da4bbb7 ("net: ethtool: relax ethnl_req_get_phydev() locking assertion")
Signed-off-by: David Yang <mmyangfl@gmail.com>
---
 drivers/net/ethernet/microchip/lan865x/lan865x.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/microchip/lan865x/lan865x.c b/drivers/net/ethernet/microchip/lan865x/lan865x.c
index 26a2761332a5..633d00857774 100644
--- a/drivers/net/ethernet/microchip/lan865x/lan865x.c
+++ b/drivers/net/ethernet/microchip/lan865x/lan865x.c
@@ -346,6 +346,8 @@ static int lan865x_probe(struct spi_device *spi)
 	spi_set_drvdata(spi, priv);
 	INIT_WORK(&priv->multicast_work, lan865x_multicast_work_handler);
 
+	netdev->netdev_ops = &lan865x_netdev_ops;
+
 	priv->tc6 = oa_tc6_init(spi, netdev, NULL);
 	if (!priv->tc6) {
 		ret = -ENODEV;
@@ -397,7 +399,6 @@ static int lan865x_probe(struct spi_device *spi)
 
 	netdev->if_port = IF_PORT_10BASET;
 	netdev->irq = spi->irq;
-	netdev->netdev_ops = &lan865x_netdev_ops;
 	netdev->ethtool_ops = &lan865x_ethtool_ops;
 
 	ret = register_netdev(netdev);
-- 
2.53.0


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH net 01/10] net: hisilicon: hisi_femac: Move setting of netops to fix crash
  2026-10-08  2:26 ` [PATCH net 01/10] net: hisilicon: hisi_femac: " David Yang
@ 2026-10-08  8:29   ` Maxime Chevallier
  2026-10-08 11:51   ` Jijie Shao
  1 sibling, 0 replies; 26+ messages in thread
From: Maxime Chevallier @ 2026-10-08  8:29 UTC (permalink / raw)
  To: David Yang, netdev
  Cc: Jian Shen, Jijie Shao, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Nicolai Buchwitz,
	Stanislav Fomichev, linux-kernel



On 10/8/26 04:26, David Yang wrote:
> hisi_femac_drv_probe() connects the PHY before dev->netdev_ops is
> assigned. phy_attach_direct() -> phy_link_topo_add_phy() reads
> dev->netdev_ops through netdev_need_ops_lock() since the commit in
> question, so probing crashes with a NULL pointer dereference when
> CONFIG_NET_SHAPER is enabled.
> 
>   phy_link_topo_add_phy from phy_attach_direct+0xec/0x37c
>   of_phy_get_and_connect from hisi_femac_drv_probe+0x1f4/0x558
>   Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
> 
> Assign netdev_ops before the PHY attach, as was done for emac in commit
> 7c9f391ec89c ("net: emac: move setting of netops to fix crash").
> 
> Fixes: ded86da4bbb7 ("net: ethtool: relax ethnl_req_get_phydev() locking assertion")
> Signed-off-by: David Yang <mmyangfl@gmail.com>

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Thanks,

Maxime

> ---
>  drivers/net/ethernet/hisilicon/hisi_femac.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/hisilicon/hisi_femac.c b/drivers/net/ethernet/hisilicon/hisi_femac.c
> index d244a40df430..016605e86f0b 100644
> --- a/drivers/net/ethernet/hisilicon/hisi_femac.c
> +++ b/drivers/net/ethernet/hisilicon/hisi_femac.c
> @@ -830,6 +830,8 @@ static int hisi_femac_drv_probe(struct platform_device *pdev)
>  		hisi_femac_phy_reset(priv);
>  	}
>  
> +	ndev->netdev_ops = &hisi_femac_netdev_ops;
> +
>  	phy = of_phy_get_and_connect(ndev, node, hisi_femac_adjust_link);
>  	if (!phy) {
>  		dev_err(dev, "connect to PHY failed!\n");
> @@ -850,7 +852,6 @@ static int hisi_femac_drv_probe(struct platform_device *pdev)
>  
>  	ndev->watchdog_timeo = 6 * HZ;
>  	ndev->priv_flags |= IFF_UNICAST_FLT;
> -	ndev->netdev_ops = &hisi_femac_netdev_ops;
>  	ndev->ethtool_ops = &hisi_femac_ethtools_ops;
>  	netif_napi_add_weight(ndev, &priv->napi, hisi_femac_poll,
>  			      FEMAC_POLL_WEIGHT);


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH net 02/10] net: hisilicon: hip04_eth: Move setting of netops to fix crash
  2026-10-08  2:26 ` [PATCH net 02/10] net: hisilicon: hip04_eth: " David Yang
@ 2026-10-08  8:30   ` Maxime Chevallier
  0 siblings, 0 replies; 26+ messages in thread
From: Maxime Chevallier @ 2026-10-08  8:30 UTC (permalink / raw)
  To: David Yang, netdev
  Cc: Jian Shen, Jijie Shao, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Jacob Keller,
	Nicolai Buchwitz, Stanislav Fomichev, linux-kernel



On 10/8/26 04:26, David Yang wrote:
> hip04_mac_probe() calls of_phy_connect() before ndev->netdev_ops is
> assigned. phy_attach_direct() -> phy_link_topo_add_phy() reads
> dev->netdev_ops through netdev_need_ops_lock() since the commit in
> question, so probing crashes with a NULL pointer dereference when
> CONFIG_NET_SHAPER is enabled.
> 
> Assign netdev_ops before the PHY attach, as was done for emac in commit
> 7c9f391ec89c ("net: emac: move setting of netops to fix crash").
> 
> Fixes: ded86da4bbb7 ("net: ethtool: relax ethnl_req_get_phydev() locking assertion")
> Signed-off-by: David Yang <mmyangfl@gmail.com>

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Thanks,

Maxime

> ---
>  drivers/net/ethernet/hisilicon/hip04_eth.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c
> index fc2c47dcfaab..d0409de5c553 100644
> --- a/drivers/net/ethernet/hisilicon/hip04_eth.c
> +++ b/drivers/net/ethernet/hisilicon/hip04_eth.c
> @@ -976,6 +976,8 @@ static int hip04_mac_probe(struct platform_device *pdev)
>  		goto init_fail;
>  	}
>  
> +	ndev->netdev_ops = &hip04_netdev_ops;
> +
>  	priv->phy_node = of_parse_phandle(node, "phy-handle", 0);
>  	if (priv->phy_node) {
>  		priv->phy = of_phy_connect(ndev, priv->phy_node,
> @@ -989,7 +991,6 @@ static int hip04_mac_probe(struct platform_device *pdev)
>  
>  	INIT_WORK(&priv->tx_timeout_task, hip04_tx_timeout_task);
>  
> -	ndev->netdev_ops = &hip04_netdev_ops;
>  	ndev->ethtool_ops = &hip04_ethtool_ops;
>  	ndev->watchdog_timeo = TX_TIMEOUT;
>  	ndev->priv_flags |= IFF_UNICAST_FLT;


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH net 03/10] net: ethernet: actions: Move setting of netops to fix crash
  2026-10-08  2:26 ` [PATCH net 03/10] net: ethernet: actions: " David Yang
@ 2026-10-08  8:30   ` Maxime Chevallier
  0 siblings, 0 replies; 26+ messages in thread
From: Maxime Chevallier @ 2026-10-08  8:30 UTC (permalink / raw)
  To: David Yang, netdev
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Andreas Färber, Manivannan Sadhasivam,
	Stanislav Fomichev, Nicolai Buchwitz, Jacob Keller,
	linux-arm-kernel, linux-actions, linux-kernel



On 10/8/26 04:26, David Yang wrote:
> owl_emac_probe() calls owl_emac_phy_init(), which connects the PHY,
> before netdev->netdev_ops is assigned. phy_attach_direct() ->
> phy_link_topo_add_phy() reads dev->netdev_ops through
> netdev_need_ops_lock() since the commit in question, so probing crashes
> with a NULL pointer dereference when CONFIG_NET_SHAPER is enabled.
> 
> Assign netdev_ops before the PHY attach, as was done for emac in commit
> 7c9f391ec89c ("net: emac: move setting of netops to fix crash").
> 
> Fixes: ded86da4bbb7 ("net: ethtool: relax ethnl_req_get_phydev() locking assertion")
> Signed-off-by: David Yang <mmyangfl@gmail.com>

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Thanks,

Maxime

> ---
>  drivers/net/ethernet/actions/owl-emac.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/actions/owl-emac.c b/drivers/net/ethernet/actions/owl-emac.c
> index 0a08da799255..2538275a1e57 100644
> --- a/drivers/net/ethernet/actions/owl-emac.c
> +++ b/drivers/net/ethernet/actions/owl-emac.c
> @@ -1552,6 +1552,8 @@ static int owl_emac_probe(struct platform_device *pdev)
>  		return ret;
>  	}
>  
> +	netdev->netdev_ops = &owl_emac_netdev_ops;
> +
>  	ret = owl_emac_phy_init(netdev);
>  	if (ret) {
>  		dev_err(dev, "failed to initialize PHY\n");
> @@ -1563,7 +1565,6 @@ static int owl_emac_probe(struct platform_device *pdev)
>  	netdev->min_mtu = OWL_EMAC_MTU_MIN;
>  	netdev->max_mtu = OWL_EMAC_MTU_MAX;
>  	netdev->watchdog_timeo = OWL_EMAC_TX_TIMEOUT;
> -	netdev->netdev_ops = &owl_emac_netdev_ops;
>  	netdev->ethtool_ops = &owl_emac_ethtool_ops;
>  	netif_napi_add(netdev, &priv->napi, owl_emac_poll);
>  

text:
Return-Path: <netdev+bounces-342827-maxime.chevallier=bootlin.com@vger.kernel.org>
Delivered-To: maxime.chevallier@bootlin.com
Received: from mail.galae.net ([172.22.1.253])
	by 9e7fea892943 with LMTP
	id IEhxF9FVx2pYBxkAtaWaaQ
	(envelope-from <netdev+bounces-342827-maxime.chevallier=bootlin.com@vger.kernel.org>)
	for <maxime.chevallier@bootlin.com>; Thu, 08 Oct 2026 10:35:29 +0200
X-Original-To: maxime.chevallier@bootlin.com
Received: from smtpin-01.galae.net (smtpin-01.galae.net [51.159.2.148])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
	(No client certificate requested)
	by mail.galae.net (Postcow) with ESMTPS id D872310333857
	for <maxime.chevallier@bootlin.com>; Thu,  8 Oct 2026 10:35:28 +0200 (CEST)
Authentication-Results: mail.galae.net;
	dkim=pass header.d=bootlin.com header.s=dkim header.b="2VH/QRrU";
	arc=pass ("subspace.kernel.org:s=arc-20240116:i=1");
	dmarc=pass (policy=reject) header.from=bootlin.com;
	spf=pass (mail.galae.net: domain of "netdev+bounces-342827-maxime.chevallier=bootlin.com@vger.kernel.org" designates 104.64.211.4 as permitted sender) smtp.mailfrom="netdev+bounces-342827-maxime.chevallier=bootlin.com@vger.kernel.org"
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com;
	s=dkim; t=1791448529;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references:list-id:
	 list-unsubscribe:list-subscribe:dkim-signature;
	bh=xxECxQ++O9X0OKyJZXgkZtO03GupF5npmg5sevhbrog=;
	b=nscG30XWyMqPAHreLeTg4rpllg6UsfY+WDchqoNl2vTjV4+VRyyxIHSh/ayokSmjGh5gbM
	ZSBS8bZeyNAgnmas9RhFCWnN3Ua/qvo5ivIu/Eoq+tiNG0XyetLWNbmfvSvok5w4c+JmZv
	k5LglvU6Wl+mcKexIAkxsGsuDf44NU2miKmi2htZS13ubS7N0RG9bqorPZx6yK2Uwf1W5Z
	JuR0stsssr4v+0pWV5S9IFfMYlRnk2APteTb1QvpdPaaaVWmoBJOy0ntz3dCsXu1m+j+on
	WtTA0gkt/vn2rG6us7t8Qw7bsCPBR7ZhsguJt4CD2oIjZJoqTreJW4SzUobkbw==
ARC-Authentication-Results: i=2;
	mail.galae.net;
	dkim=pass header.d=bootlin.com header.s=dkim header.b="2VH/QRrU";
	arc=pass ("subspace.kernel.org:s=arc-20240116:i=1");
	dmarc=pass (policy=reject) header.from=bootlin.com;
	spf=pass (mail.galae.net: domain of "netdev+bounces-342827-maxime.chevallier=bootlin.com@vger.kernel.org" designates 104.64.211.4 as permitted sender) smtp.mailfrom="netdev+bounces-342827-maxime.chevallier=bootlin.com@vger.kernel.org"
ARC-Seal: i=2; s=dkim; d=bootlin.com; t=1791448529; a=rsa-sha256; cv=pass;
	b=jJ7iUlEal41Mf8G+dDKojvkow1cgI70DXK02SWWHhsKHbEXzEIPk1kVfdFfRCsukHbyu3u
	AoIfYIE2gsMpPcTSRCHXCjGIBNr4tBWVZxYdTDgr2PjmvsvKiENDcGdlNxut7l8uDiv3bO
	TMWvb05R4x53qm0pa9glKul4tBnj1fGGZlLhWEuxnhpVMmbnTl6/KleAX6pzXBF//JRAYv
	d6X803SGdyj7GZxvvBWaUmS8zPAC1FEhbHe/ixKqhP9OO4v/DP9jGAiN/ALujxTffIfZxU
	naFxZTVOzgKs12ymi8DriysuBnj8BjFftDPROp5jAIpwCDeMA0Nx/w6judC3aQ==
Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by smtpin-01.galae.net (Postfix) with ESMTPS id 4B867342DA8
	for <maxime.chevallier@bootlin.com>; Thu,  8 Oct 2026 08:35:28 +0000 (UTC)
Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by sin.lore.kernel.org (Postfix) with ESMTP id BA7A029484
	for <maxime.chevallier@bootlin.com>; Thu,  8 Oct 2026 08:30:35 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 2307246A611;
	Thu,  8 Oct 2026 08:30:32 +0000 (UTC)
X-Original-To: netdev@vger.kernel.org
Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B24A3D75A4
	for <netdev@vger.kernel.org>; Thu,  8 Oct 2026 08:30:29 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1791448231; cv=none; b=II8Freetrleip4oSbfpXXxseiNWyQ52JbLgSXjhRrzu7xGVszuTvo+qFoonkB3pdxXrv99qKkYQWvk+Xt622x7SE6JpXCDu6GvALGYDzUyXQPlJp/49dBdfwC73YTnC3ktfxIzuFdWHSd4FOETKXLAWfad2q2/4fE3K4WhiFUZ4=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1791448231; c=relaxed/simple;
	bh=NK4BN9I4Kbmst7DqPYbh2MeXJQp4Qdfp8C4ZhaQniaU=;
	h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
	 In-Reply-To:Content-Type; b=nkJiCWsGxIvYdEf9LTk4jHmqH5BykINm8GXTLkgv2+xvIKJlWkIB7hJJdpD0hsKujdghX//UHYOeBKdz9VTvXKeDxBZ3K+MfF49+O/oqLiTSXY5DZhk2ahtmUsKdvb0ZQvn7vU2+xX2sOKthuECpKu/TjMHDpPEGe1hcEpptoQ4=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=2VH/QRrU; arc=none smtp.client-ip=185.246.84.56
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com
Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233])
	by smtpout-02.galae.net (Postfix) with ESMTPS id F3ACE1A1185;
	Thu,  8 Oct 2026 08:30:27 +0000 (UTC)
Received: from mail.galae.net (mail.galae.net [212.83.136.155])
	by smtpout-01.galae.net (Postfix) with ESMTPS id C3FEC60341;
	Thu,  8 Oct 2026 08:30:27 +0000 (UTC)
Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id B0D4810333850;
	Thu,  8 Oct 2026 10:30:21 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim;
	t=1791448226; h=from:subject:date:message-id:to:cc:mime-version:content-type:
	 content-transfer-encoding:content-language:in-reply-to:references;
	bh=xxECxQ++O9X0OKyJZXgkZtO03GupF5npmg5sevhbrog=;
	b=2VH/QRrUho2xFw/tBmEw9RjXx/KeuK4roNPFgZM78+4XHVP4W2OQzheGIGq3728PvD02yt
	C2Gb8SokhmGuvHzU/vj3D+zMCFZWPASBe11zuv36fSDGdjRE2TS/gzxPjO5BnMmZ5OsfWE
	jA2r3Ad2tEPK5yjme2raaU1kZBfJdHUMGj3SJqIHsZFroLdXUeQLWkuPYsWPvO8Ri5BYhn
	Gnh9dED8kgmEjiIMkPX7Zx52ki6WeGTsMPTR8gdk/EuMyGwBDgnVnv8FqWANPelltfgxMq
	rQb7snen7yxmwPmLztfLmullzXxqsrEryAaHzasSoZC423QjI8DhPOkHUeoJ3A==
Message-ID: <b44d36a0-43a1-4399-8c79-29d1f57984cd@bootlin.com>
Date: Thu, 8 Oct 2026 10:30:20 +0200
Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
List-Id: <netdev.vger.kernel.org>
List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH net 03/10] net: ethernet: actions: Move setting of netops
 to fix crash
To: David Yang <mmyangfl@gmail.com>, netdev@vger.kernel.org
Cc: Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller"
 <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>,
 Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
 =?UTF-8?Q?Andreas_F=C3=A4rber?= <afaerber@suse.de>,
 Manivannan Sadhasivam <mani@kernel.org>, Stanislav Fomichev
 <sdf@fomichev.me>, Nicolai Buchwitz <nb@tipi-net.de>,
 Jacob Keller <jacob.e.keller@intel.com>,
 linux-arm-kernel@lists.infradead.org, linux-actions@lists.infradead.org,
 linux-kernel@vger.kernel.org
References: <20261008022656.3592191-1-mmyangfl@gmail.com>
 <20261008022656.3592191-4-mmyangfl@gmail.com>
Content-Language: en-US
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
In-Reply-To: <20261008022656.3592191-4-mmyangfl@gmail.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Last-TLS-Session-Version: TLSv1.3
X-Last-TLS-Session-Version: TLSv1.3
X-Spamd-Result: default: False [-2.14 / 30.00];
	SUSPICIOUS_RECIPS(1.50)[];
	IP_REPUTATION_HAM(-1.41)[asn: 63949(-0.40), country: SG(-0.01), ip: 104.64.211.4(-1.00)];
	ARC_ALLOW(-1.00)[subspace.kernel.org:s=arc-20240116:i=1];
	DMARC_POLICY_ALLOW(-0.50)[bootlin.com,reject];
	R_SPF_ALLOW(-0.20)[+ip4:104.64.211.4:c];
	R_DKIM_ALLOW(-0.20)[bootlin.com:s=dkim];
	MAILLIST(-0.15)[generic];
	MIME_GOOD(-0.10)[text/plain];
	BAYES_HAM(-0.06)[56.67%];
	MX_GOOD(-0.01)[];
	HAS_LIST_UNSUB(-0.01)[];
	URIBL_BLOCKED(0.00)[sin.lore.kernel.org:helo,sin.lore.kernel.org:rdns,bootlin.com:mid,bootlin.com:email,bootlin.com:dkim];
	RCVD_TLS_LAST(0.00)[];
	RECEIVED_HELO_LOCALHOST(0.00)[];
	RCPT_MAILCOW_DOMAIN(0.00)[bootlin.com];
	MAILCOW_DOMAIN_HEADER_FROM(0.00)[bootlin.com];
	RCPT_COUNT_TWELVE(0.00)[15];
	TO_DN_SOME(0.00)[];
	FREEMAIL_TO(0.00)[gmail.com,vger.kernel.org];
	MIME_TRACE(0.00)[0:+];
	BCC(0.00)[];
	FORGED_SENDER_MAILLIST(0.00)[];
	TAGGED_FROM(0.00)[bounces-342827-maxime.chevallier=bootlin.com];
	RBL_SENDERSCORE_REPUT_BLOCKED(0.00)[104.64.211.4:from];
	DKIM_TRACE(0.00)[bootlin.com:+];
	DNSWL_BLOCKED(0.00)[100.90.174.1:received,212.83.136.155:received,104.64.211.4:from,212.83.139.233:received,185.246.84.56:received];
	NEURAL_HAM(-0.00)[-1.000];
	PRECEDENCE_BULK(0.00)[];
	FROM_HAS_DN(0.00)[];
	FROM_NEQ_ENVFROM(0.00)[maxime.chevallier@bootlin.com,netdev@vger.kernel.org];
	ARC_SIGNED(0.00)[bootlin.com:s=dkim:i=2];
	MID_RHS_MATCH_FROM(0.00)[];
	TAGGED_RCPT(0.00)[netdev];
	FORGED_RECIPIENTS_MAILLIST(0.00)[];
	DWL_DNSWL_BLOCKED(0.00)[bootlin.com:dkim];
	ASN(0.00)[asn:63949, ipnet:104.64.192.0/19, country:SG];
	RCVD_VIA_SMTP_AUTH(0.00)[];
	EXTERNAL_RELAY_AUTHENTICATED(0.00)[];
	RCVD_COUNT_SEVEN(0.00)[7]
X-Rspamd-Queue-Id: D872310333857



On 10/8/26 04:26, David Yang wrote:
> owl_emac_probe() calls owl_emac_phy_init(), which connects the PHY,
> before netdev->netdev_ops is assigned. phy_attach_direct() ->
> phy_link_topo_add_phy() reads dev->netdev_ops through
> netdev_need_ops_lock() since the commit in question, so probing crashes
> with a NULL pointer dereference when CONFIG_NET_SHAPER is enabled.
> 
> Assign netdev_ops before the PHY attach, as was done for emac in commit
> 7c9f391ec89c ("net: emac: move setting of netops to fix crash").
> 
> Fixes: ded86da4bbb7 ("net: ethtool: relax ethnl_req_get_phydev() locking assertion")
> Signed-off-by: David Yang <mmyangfl@gmail.com>

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Thanks,

Maxime

> ---
>  drivers/net/ethernet/actions/owl-emac.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/actions/owl-emac.c b/drivers/net/ethernet/actions/owl-emac.c
> index 0a08da799255..2538275a1e57 100644
> --- a/drivers/net/ethernet/actions/owl-emac.c
> +++ b/drivers/net/ethernet/actions/owl-emac.c
> @@ -1552,6 +1552,8 @@ static int owl_emac_probe(struct platform_device *pdev)
>  		return ret;
>  	}
>  
> +	netdev->netdev_ops = &owl_emac_netdev_ops;
> +
>  	ret = owl_emac_phy_init(netdev);
>  	if (ret) {
>  		dev_err(dev, "failed to initialize PHY\n");
> @@ -1563,7 +1565,6 @@ static int owl_emac_probe(struct platform_device *pdev)
>  	netdev->min_mtu = OWL_EMAC_MTU_MIN;
>  	netdev->max_mtu = OWL_EMAC_MTU_MAX;
>  	netdev->watchdog_timeo = OWL_EMAC_TX_TIMEOUT;
> -	netdev->netdev_ops = &owl_emac_netdev_ops;
>  	netdev->ethtool_ops = &owl_emac_ethtool_ops;
>  	netif_napi_add(netdev, &priv->napi, owl_emac_poll);
>  



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH net 04/10] net: ethernet: adi: Move setting of netops to fix crash
  2026-10-08  2:26 ` [PATCH net 04/10] net: ethernet: adi: " David Yang
@ 2026-10-08  8:30   ` Maxime Chevallier
  2026-10-09 13:03   ` Regus, Ciprian
  1 sibling, 0 replies; 26+ messages in thread
From: Maxime Chevallier @ 2026-10-08  8:30 UTC (permalink / raw)
  To: David Yang, netdev
  Cc: Ciprian Regus, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Stanislav Fomichev,
	Nicolai Buchwitz, linux-kernel



On 10/8/26 04:26, David Yang wrote:
> adin1140_probe() calls adin1140_phy_init(), which connects the PHY,
> before netdev->netdev_ops is assigned. phy_attach_direct() ->
> phy_link_topo_add_phy() reads dev->netdev_ops through
> netdev_need_ops_lock() since the commit in question, so probing crashes
> with a NULL pointer dereference when CONFIG_NET_SHAPER is enabled.
> 
> Assign netdev_ops before the PHY attach, as was done for emac in commit
> 7c9f391ec89c ("net: emac: move setting of netops to fix crash").
> 
> Fixes: ded86da4bbb7 ("net: ethtool: relax ethnl_req_get_phydev() locking assertion")
> Signed-off-by: David Yang <mmyangfl@gmail.com>

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Thanks,

Maxime

> ---
>  drivers/net/ethernet/adi/adin1140.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/adi/adin1140.c b/drivers/net/ethernet/adi/adin1140.c
> index 93710baca151..ca96a919c24b 100644
> --- a/drivers/net/ethernet/adi/adin1140.c
> +++ b/drivers/net/ethernet/adi/adin1140.c
> @@ -733,6 +733,8 @@ static int adin1140_probe(struct spi_device *spi)
>  	if (ret)
>  		return ret;
>  
> +	netdev->netdev_ops = &adin1140_netdev_ops;
> +
>  	ret = adin1140_phy_init(priv, spi);
>  	if (ret)
>  		return ret;
> @@ -748,7 +750,6 @@ static int adin1140_probe(struct spi_device *spi)
>  
>  	netdev->if_port = IF_PORT_10BASET;
>  	netdev->irq = spi->irq;
> -	netdev->netdev_ops = &adin1140_netdev_ops;
>  	netdev->ethtool_ops = &adin1140_ethtool_ops;
>  	netdev->netns_immutable = true;
>  	netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE |

text:
Return-Path: <netdev+bounces-342828-maxime.chevallier=bootlin.com@vger.kernel.org>
Delivered-To: maxime.chevallier@bootlin.com
Received: from mail.galae.net ([172.22.1.253])
	by 9e7fea892943 with LMTP
	id kIv3N/lUx2oM9xgAtaWaaQ
	(envelope-from <netdev+bounces-342828-maxime.chevallier=bootlin.com@vger.kernel.org>)
	for <maxime.chevallier@bootlin.com>; Thu, 08 Oct 2026 10:31:53 +0200
X-Original-To: maxime.chevallier@bootlin.com
Received: from smtpin-01.galae.net (smtpin-01.galae.net [51.159.2.148])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
	(No client certificate requested)
	by mail.galae.net (Postcow) with ESMTPS id 25C4110333853
	for <maxime.chevallier@bootlin.com>; Thu,  8 Oct 2026 10:31:53 +0200 (CEST)
Authentication-Results: mail.galae.net;
	dkim=pass header.d=bootlin.com header.s=dkim header.b="STo/Jjwc";
	arc=pass ("subspace.kernel.org:s=arc-20240116:i=1");
	dmarc=pass (policy=reject) header.from=bootlin.com;
	spf=pass (mail.galae.net: domain of "netdev+bounces-342828-maxime.chevallier=bootlin.com@vger.kernel.org" designates 172.234.253.10 as permitted sender) smtp.mailfrom="netdev+bounces-342828-maxime.chevallier=bootlin.com@vger.kernel.org"
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com;
	s=dkim; t=1791448313;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references:list-id:
	 list-unsubscribe:list-subscribe:dkim-signature;
	bh=C8HerE4JC8nfRjub4rsf8mucx/GS3daCCcx3JUHV+As=;
	b=Drktp9RVVuqf4s/U/FLLpWuviT7neJGvMUwST7dRUAr0zRs0NZGYpOAGdKDcIuOXtLlC8Z
	W5ep16KPyoFBQ70TRfkV4ddG91t3ghiLvz3WtW/jNFXXWQ5oVM3HmVkZN/gAvw4OSKzZnR
	KN6cuUap1Mc/x5gGx2Rg4xyPI2UXFXy0cCs7iQzX+CuIeLZYYzlAb+liwT2mZvoWufg8iD
	ooBTxbc2X7X2FPcgtj4swD06tzVP8x/5zX32gakGRjvaXC7KytMs+xkUFBIfMKAicdd/kW
	x3CkfS7Cq+N9gvRHGacMpELVjWcuQUzzR/5d5Z+IlJwSeCM/0pBZPxuN1xKPgA==
ARC-Authentication-Results: i=2;
	mail.galae.net;
	dkim=pass header.d=bootlin.com header.s=dkim header.b="STo/Jjwc";
	arc=pass ("subspace.kernel.org:s=arc-20240116:i=1");
	dmarc=pass (policy=reject) header.from=bootlin.com;
	spf=pass (mail.galae.net: domain of "netdev+bounces-342828-maxime.chevallier=bootlin.com@vger.kernel.org" designates 172.234.253.10 as permitted sender) smtp.mailfrom="netdev+bounces-342828-maxime.chevallier=bootlin.com@vger.kernel.org"
ARC-Seal: i=2; s=dkim; d=bootlin.com; t=1791448313; a=rsa-sha256; cv=pass;
	b=rejfXZpv5p3I+zCIlsWsSpBY5diQJ7QHdEg4bHUQcot22JZYq7SprsxbvVySrHyk7c4i2u
	Ki0p3Eq/ALJZ79lv624zE/Qk1lOlkgIOyFEOEVmtveR4IVPWkLAlM+3VlsdyxRlnv2JNSs
	qZVVJM2YiqQfJoBb24/w3ElNGUKAwzaZMmhhV0tekr8Ht16+wWZsomDcl0L3+N3IqZ5PH9
	s3DjAlT8h+WJ2+liRpeJU96mTkKN5Ru/Jd8Enys2j6dr8Svh02U8bXMLTbY/G6NBul+0Vm
	3kDbpB5V045Lgg+EYoi0un86GwFiIFwfzfI40Hmzyncr31XLY//1B9kKCOkTGg==
Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by smtpin-01.galae.net (Postfix) with ESMTPS id 9B6BE342DC1
	for <maxime.chevallier@bootlin.com>; Thu,  8 Oct 2026 08:31:52 +0000 (UTC)
Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by sea.lore.kernel.org (Postfix) with ESMTP id 7224A30215
	for <maxime.chevallier@bootlin.com>; Thu,  8 Oct 2026 08:31:03 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 4452646EC76;
	Thu,  8 Oct 2026 08:31:03 +0000 (UTC)
X-Original-To: netdev@vger.kernel.org
Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id F1AA346D567
	for <netdev@vger.kernel.org>; Thu,  8 Oct 2026 08:31:00 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1791448262; cv=none; b=KtR2J9J/9Z5qoNq71RB1xLgxSC58xjYjHqEp1XkgdY2lEEWytcUsfr4K9FaD07PBlKDtY8KSEgjszEz0OO2UjbbjskXsg2Rj44AqAmyEH1b5UC2ULcs1YxvopV7GEQV1muvoV346eA/a8LYECT/wCi4TNf/RXrHW2t0TBRJqWOQ=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1791448262; c=relaxed/simple;
	bh=VQRhDymlHxO4P15VM7Zlak+T81ZfGzO7SacCihV8224=;
	h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
	 In-Reply-To:Content-Type; b=lehfxLeQxBG11s4+UjyKhGvlBoeKywy5EM1s2g5zyYyiMYny0WUVP+4B2WPK1Kd2cgfkQRWd+1+bL8XWTsbnmuXHXQW03HEG1Fya6U6LvFiaC2im0OMLoylv7J/9M4ajERpLskLxj5ES20nfzf19jxKXuRf5EkGQ8LskPhw1sxg=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=STo/Jjwc; arc=none smtp.client-ip=185.246.84.56
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com
Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233])
	by smtpout-02.galae.net (Postfix) with ESMTPS id 8A96D1A1185;
	Thu,  8 Oct 2026 08:30:59 +0000 (UTC)
Received: from mail.galae.net (mail.galae.net [212.83.136.155])
	by smtpout-01.galae.net (Postfix) with ESMTPS id 5D81660341;
	Thu,  8 Oct 2026 08:30:59 +0000 (UTC)
Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id E66AE10333850;
	Thu,  8 Oct 2026 10:30:54 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim;
	t=1791448258; h=from:subject:date:message-id:to:cc:mime-version:content-type:
	 content-transfer-encoding:content-language:in-reply-to:references;
	bh=C8HerE4JC8nfRjub4rsf8mucx/GS3daCCcx3JUHV+As=;
	b=STo/Jjwc2OQdmXHw0M5scCfqG7Joy1lnnPSPQBCWUq9fcq9K32y3153GIAZ+KR5MhYiKiR
	m+Civc4hdj51qVGXPJvk7Cqr2COY2FyApwqzVYvthAdAs29cFe7ae8nsoHBWN0bxnSzEKQ
	cZrbqbzEWLIqyCyDyJ1GHLtPwwlvMeSsMNFnb3nQ2M2cEIq1+f9+1x4XfaZAop7T7AvgiT
	eM6lT6RQCFLab/C8bN2HEwZSJLGXs8D33iWL2mXvXZN3adLsvZo4+lmaVGZLTQIYu9m+00
	IZ6tOQXxgaVTyThXjTAeTJKS9ac9zFCT6zwRy12Ll+EdgVc4WqVeRf830N8V/A==
Message-ID: <cb745ce9-c100-4c16-b9b1-670379d0bdef@bootlin.com>
Date: Thu, 8 Oct 2026 10:30:54 +0200
Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
List-Id: <netdev.vger.kernel.org>
List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH net 04/10] net: ethernet: adi: Move setting of netops to
 fix crash
To: David Yang <mmyangfl@gmail.com>, netdev@vger.kernel.org
Cc: Ciprian Regus <ciprian.regus@analog.com>,
 Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller"
 <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>,
 Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
 Stanislav Fomichev <sdf@fomichev.me>, Nicolai Buchwitz <nb@tipi-net.de>,
 linux-kernel@vger.kernel.org
References: <20261008022656.3592191-1-mmyangfl@gmail.com>
 <20261008022656.3592191-5-mmyangfl@gmail.com>
Content-Language: en-US
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
In-Reply-To: <20261008022656.3592191-5-mmyangfl@gmail.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Last-TLS-Session-Version: TLSv1.3
X-Last-TLS-Session-Version: TLSv1.3
X-Spamd-Result: default: False [-2.25 / 30.00];
	SUSPICIOUS_RECIPS(1.50)[];
	IP_REPUTATION_HAM(-1.41)[asn: 63949(-0.40), country: SG(-0.01), ip: 172.234.253.10(-1.00)];
	ARC_ALLOW(-1.00)[subspace.kernel.org:s=arc-20240116:i=1];
	DMARC_POLICY_ALLOW(-0.50)[bootlin.com,reject];
	R_SPF_ALLOW(-0.20)[+ip4:172.234.253.10:c];
	R_DKIM_ALLOW(-0.20)[bootlin.com:s=dkim];
	BAYES_HAM(-0.17)[64.78%];
	MAILLIST(-0.15)[generic];
	MIME_GOOD(-0.10)[text/plain];
	MX_GOOD(-0.01)[];
	HAS_LIST_UNSUB(-0.01)[];
	URIBL_BLOCKED(0.00)[bootlin.com:mid,bootlin.com:email,bootlin.com:dkim,sea.lore.kernel.org:helo,sea.lore.kernel.org:rdns];
	TAGGED_FROM(0.00)[bounces-342828-maxime.chevallier=bootlin.com];
	RCVD_TLS_LAST(0.00)[];
	TO_DN_SOME(0.00)[];
	MIME_TRACE(0.00)[0:+];
	RECEIVED_HELO_LOCALHOST(0.00)[];
	BCC(0.00)[];
	MAILCOW_DOMAIN_HEADER_FROM(0.00)[bootlin.com];
	FORGED_SENDER_MAILLIST(0.00)[];
	FREEMAIL_TO(0.00)[gmail.com,vger.kernel.org];
	RCPT_MAILCOW_DOMAIN(0.00)[bootlin.com];
	RBL_SENDERSCORE_REPUT_BLOCKED(0.00)[172.234.253.10:from];
	DKIM_TRACE(0.00)[bootlin.com:+];
	FORGED_RECIPIENTS_MAILLIST(0.00)[];
	DNSWL_BLOCKED(0.00)[100.90.174.1:received,172.234.253.10:from,212.83.139.233:received,185.246.84.56:received,212.83.136.155:received];
	NEURAL_HAM(-0.00)[-1.000];
	PRECEDENCE_BULK(0.00)[];
	FROM_HAS_DN(0.00)[];
	FROM_NEQ_ENVFROM(0.00)[maxime.chevallier@bootlin.com,netdev@vger.kernel.org];
	ARC_SIGNED(0.00)[bootlin.com:s=dkim:i=2];
	MID_RHS_MATCH_FROM(0.00)[];
	DWL_DNSWL_BLOCKED(0.00)[bootlin.com:dkim];
	ASN(0.00)[asn:63949, ipnet:172.234.224.0/19, country:SG];
	RCPT_COUNT_SEVEN(0.00)[11];
	EXTERNAL_RELAY_AUTHENTICATED(0.00)[];
	TAGGED_RCPT(0.00)[netdev];
	RCVD_VIA_SMTP_AUTH(0.00)[];
	RCVD_COUNT_SEVEN(0.00)[7]
X-Rspamd-Queue-Id: 25C4110333853



On 10/8/26 04:26, David Yang wrote:
> adin1140_probe() calls adin1140_phy_init(), which connects the PHY,
> before netdev->netdev_ops is assigned. phy_attach_direct() ->
> phy_link_topo_add_phy() reads dev->netdev_ops through
> netdev_need_ops_lock() since the commit in question, so probing crashes
> with a NULL pointer dereference when CONFIG_NET_SHAPER is enabled.
> 
> Assign netdev_ops before the PHY attach, as was done for emac in commit
> 7c9f391ec89c ("net: emac: move setting of netops to fix crash").
> 
> Fixes: ded86da4bbb7 ("net: ethtool: relax ethnl_req_get_phydev() locking assertion")
> Signed-off-by: David Yang <mmyangfl@gmail.com>

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Thanks,

Maxime

> ---
>  drivers/net/ethernet/adi/adin1140.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/adi/adin1140.c b/drivers/net/ethernet/adi/adin1140.c
> index 93710baca151..ca96a919c24b 100644
> --- a/drivers/net/ethernet/adi/adin1140.c
> +++ b/drivers/net/ethernet/adi/adin1140.c
> @@ -733,6 +733,8 @@ static int adin1140_probe(struct spi_device *spi)
>  	if (ret)
>  		return ret;
>  
> +	netdev->netdev_ops = &adin1140_netdev_ops;
> +
>  	ret = adin1140_phy_init(priv, spi);
>  	if (ret)
>  		return ret;
> @@ -748,7 +750,6 @@ static int adin1140_probe(struct spi_device *spi)
>  
>  	netdev->if_port = IF_PORT_10BASET;
>  	netdev->irq = spi->irq;
> -	netdev->netdev_ops = &adin1140_netdev_ops;
>  	netdev->ethtool_ops = &adin1140_ethtool_ops;
>  	netdev->netns_immutable = true;
>  	netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE |



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH net 06/10] net: au1000: move setting of netops to fix crash
  2026-10-08  2:26 ` [PATCH net 06/10] net: au1000: " David Yang
@ 2026-10-08  8:31   ` Maxime Chevallier
  0 siblings, 0 replies; 26+ messages in thread
From: Maxime Chevallier @ 2026-10-08  8:31 UTC (permalink / raw)
  To: David Yang, netdev
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Runyu Xiao, Simon Horman, Jacob Keller,
	Nicolai Buchwitz, linux-kernel



On 10/8/26 04:26, David Yang wrote:
> au1000_probe() calls au1000_mii_probe(), which connects the PHY,
> before dev->netdev_ops is assigned. phy_attach_direct() ->
> phy_link_topo_add_phy() reads dev->netdev_ops through
> netdev_need_ops_lock() since the commit in question, so probing crashes
> with a NULL pointer dereference when CONFIG_NET_SHAPER is enabled.
> 
> Assign netdev_ops before the PHY attach, as was done for emac in commit
> 7c9f391ec89c ("net: emac: move setting of netops to fix crash").
> 
> Fixes: ded86da4bbb7 ("net: ethtool: relax ethnl_req_get_phydev() locking assertion")
> Signed-off-by: David Yang <mmyangfl@gmail.com>

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Thanks,

Maxime

> ---
>  drivers/net/ethernet/amd/au1000_eth.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/amd/au1000_eth.c b/drivers/net/ethernet/amd/au1000_eth.c
> index 5a04056e38fa..8682323d693f 100644
> --- a/drivers/net/ethernet/amd/au1000_eth.c
> +++ b/drivers/net/ethernet/amd/au1000_eth.c
> @@ -1225,6 +1225,8 @@ static int au1000_probe(struct platform_device *pdev)
>  		goto err_mdiobus_reg;
>  	}
>  
> +	dev->netdev_ops = &au1000_netdev_ops;
> +
>  	err = au1000_mii_probe(dev);
>  	if (err != 0)
>  		goto err_out;
> @@ -1263,7 +1265,6 @@ static int au1000_probe(struct platform_device *pdev)
>  
>  	dev->base_addr = base->start;
>  	dev->irq = irq;
> -	dev->netdev_ops = &au1000_netdev_ops;
>  	dev->ethtool_ops = &au1000_ethtool_ops;
>  	dev->watchdog_timeo = ETH_TX_TIMEOUT;
>  


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH net 07/10] net: ethoc: move setting of netops to fix crash
  2026-10-08  2:26 ` [PATCH net 07/10] net: ethoc: " David Yang
@ 2026-10-08  8:31   ` Maxime Chevallier
  2026-10-13 10:00   ` Daniel Machon
  1 sibling, 0 replies; 26+ messages in thread
From: Maxime Chevallier @ 2026-10-08  8:31 UTC (permalink / raw)
  To: David Yang, netdev
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Stanislav Fomichev, Jacob Keller, linux-kernel



On 10/8/26 04:26, David Yang wrote:
> ethoc_probe() calls ethoc_mdio_probe(), which connects the PHY,
> before netdev->netdev_ops is assigned. phy_attach_direct() ->
> phy_link_topo_add_phy() reads dev->netdev_ops through
> netdev_need_ops_lock() since the commit in question, so probing crashes
> with a NULL pointer dereference when CONFIG_NET_SHAPER is enabled.
> 
> Assign netdev_ops before the PHY attach, as was done for emac in commit
> 7c9f391ec89c ("net: emac: move setting of netops to fix crash").
> 
> Fixes: ded86da4bbb7 ("net: ethtool: relax ethnl_req_get_phydev() locking assertion")
> Signed-off-by: David Yang <mmyangfl@gmail.com>

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Thanks,

Maxime

> ---
>  drivers/net/ethernet/ethoc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c
> index 0c418557264c..e5b7df43e8f6 100644
> --- a/drivers/net/ethernet/ethoc.c
> +++ b/drivers/net/ethernet/ethoc.c
> @@ -1211,6 +1211,8 @@ static int ethoc_probe(struct platform_device *pdev)
>  		goto free3;
>  	}
>  
> +	netdev->netdev_ops = &ethoc_netdev_ops;
> +
>  	ret = ethoc_mdio_probe(netdev);
>  	if (ret) {
>  		dev_err(&netdev->dev, "failed to probe MDIO bus\n");
> @@ -1218,7 +1220,6 @@ static int ethoc_probe(struct platform_device *pdev)
>  	}
>  
>  	/* setup the net_device structure */
> -	netdev->netdev_ops = &ethoc_netdev_ops;
>  	netdev->watchdog_timeo = ETHOC_TIMEOUT;
>  	netdev->features |= 0;
>  	netdev->ethtool_ops = &ethoc_ethtool_ops;


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH net 08/10] net: ethernet: aeroflex: move setting of netops to fix crash
  2026-10-08  2:26 ` [PATCH net 08/10] net: ethernet: aeroflex: " David Yang
@ 2026-10-08  8:31   ` Maxime Chevallier
  2026-10-09 14:34   ` Andreas Larsson
  1 sibling, 0 replies; 26+ messages in thread
From: Maxime Chevallier @ 2026-10-08  8:31 UTC (permalink / raw)
  To: David Yang, netdev
  Cc: Andreas Larsson, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Jacob Keller, Stanislav Fomichev,
	linux-kernel



On 10/8/26 04:26, David Yang wrote:
> greth_of_probe() calls greth_mdio_init(), which connects the PHY,
> before dev->netdev_ops is assigned. phy_attach_direct() ->
> phy_link_topo_add_phy() reads dev->netdev_ops through
> netdev_need_ops_lock() since the commit in question, so probing crashes
> with a NULL pointer dereference when CONFIG_NET_SHAPER is enabled.
> 
> Assign netdev_ops before the PHY attach, as was done for emac in commit
> 7c9f391ec89c ("net: emac: move setting of netops to fix crash").
> 
> Fixes: ded86da4bbb7 ("net: ethtool: relax ethnl_req_get_phydev() locking assertion")
> Signed-off-by: David Yang <mmyangfl@gmail.com>

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Thanks,

Maxime

> ---
>  drivers/net/ethernet/aeroflex/greth.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c
> index a593adc16c78..fccb67beebee 100644
> --- a/drivers/net/ethernet/aeroflex/greth.c
> +++ b/drivers/net/ethernet/aeroflex/greth.c
> @@ -1421,6 +1421,8 @@ static int greth_of_probe(struct platform_device *ofdev)
>  	/* Check if MAC can handle MDIO interrupts */
>  	greth->mdio_int_en = (tmp >> 26) & 1;
>  
> +	dev->netdev_ops = &greth_netdev_ops;
> +
>  	err = greth_mdio_init(greth);
>  	if (err) {
>  		if (netif_msg_probe(greth))
> @@ -1498,7 +1500,6 @@ static int greth_of_probe(struct platform_device *ofdev)
>  		dev->flags &= ~IFF_MULTICAST;
>  	}
>  
> -	dev->netdev_ops = &greth_netdev_ops;
>  	dev->ethtool_ops = &greth_ethtool_ops;
>  
>  	err = register_netdev(dev);


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH net 09/10] net: ti: icssm-prueth: Move setting of netops to fix crash
  2026-10-08  2:26 ` [PATCH net 09/10] net: ti: icssm-prueth: Move " David Yang
@ 2026-10-08  8:32   ` Maxime Chevallier
  0 siblings, 0 replies; 26+ messages in thread
From: Maxime Chevallier @ 2026-10-08  8:32 UTC (permalink / raw)
  To: David Yang, netdev
  Cc: MD Danish Anwar, Parvathi Pudi, Roger Quadros,
	Mohan Reddy Putluru, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Jacob Keller, Stanislav Fomichev,
	Nicolai Buchwitz, linux-arm-kernel, linux-kernel



On 10/8/26 04:26, David Yang wrote:
> icssm_prueth_netdev_init() calls of_phy_get_and_connect() before
> ndev->netdev_ops is assigned. phy_attach_direct() ->
> phy_link_topo_add_phy() reads dev->netdev_ops through
> netdev_need_ops_lock() since the commit in question, so probing crashes
> with a NULL pointer dereference when CONFIG_NET_SHAPER is enabled.
> 
> Assign netdev_ops before the PHY attach, as was done for emac in commit
> 7c9f391ec89c ("net: emac: move setting of netops to fix crash").
> 
> Fixes: ded86da4bbb7 ("net: ethtool: relax ethnl_req_get_phydev() locking assertion")
> Signed-off-by: David Yang <mmyangfl@gmail.com>

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Thanks,

Maxime

> ---
>  drivers/net/ethernet/ti/icssm/icssm_prueth.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/ti/icssm/icssm_prueth.c b/drivers/net/ethernet/ti/icssm/icssm_prueth.c
> index b7e94244355a..b42c98e861e0 100644
> --- a/drivers/net/ethernet/ti/icssm/icssm_prueth.c
> +++ b/drivers/net/ethernet/ti/icssm/icssm_prueth.c
> @@ -1563,6 +1563,8 @@ static int icssm_prueth_netdev_init(struct prueth *prueth,
>  	}
>  	ether_addr_copy(emac->mac_addr, ndev->dev_addr);
>  
> +	ndev->netdev_ops = &emac_netdev_ops;
> +
>  	/* connect PHY */
>  	emac->phydev = of_phy_get_and_connect(ndev, eth_node,
>  					      icssm_emac_adjust_link);
> @@ -1590,7 +1592,6 @@ static int icssm_prueth_netdev_init(struct prueth *prueth,
>  	}
>  
>  	ndev->dev.of_node = eth_node;
> -	ndev->netdev_ops = &emac_netdev_ops;
>  
>  	netif_napi_add(ndev, &emac->napi, icssm_emac_napi_poll);
>  

text:
Return-Path: <netdev+bounces-342830-maxime.chevallier=bootlin.com@vger.kernel.org>
Delivered-To: maxime.chevallier@bootlin.com
Received: from mail.galae.net ([172.22.1.253])
	by 9e7fea892943 with LMTP
	id kOIoI45Wx2pNGRkAtaWaaQ
	(envelope-from <netdev+bounces-342830-maxime.chevallier=bootlin.com@vger.kernel.org>)
	for <maxime.chevallier@bootlin.com>; Thu, 08 Oct 2026 10:38:38 +0200
X-Original-To: maxime.chevallier@bootlin.com
Received: from smtpin-01.galae.net (smtpin-01.galae.net [51.159.2.148])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
	(No client certificate requested)
	by mail.galae.net (Postcow) with ESMTPS id 23E71103303A7
	for <maxime.chevallier@bootlin.com>; Thu,  8 Oct 2026 10:38:37 +0200 (CEST)
Authentication-Results: mail.galae.net;
	dkim=pass header.d=bootlin.com header.s=dkim header.b="yyHoI/ox";
	arc=pass ("subspace.kernel.org:s=arc-20240116:i=1");
	dmarc=pass (policy=reject) header.from=bootlin.com;
	spf=pass (mail.galae.net: domain of "netdev+bounces-342830-maxime.chevallier=bootlin.com@vger.kernel.org" designates 172.105.105.114 as permitted sender) smtp.mailfrom="netdev+bounces-342830-maxime.chevallier=bootlin.com@vger.kernel.org"
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com;
	s=dkim; t=1791448718;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references:list-id:
	 list-unsubscribe:list-subscribe:dkim-signature;
	bh=DKhOUStc32yyJJh2yPmsAjtT0L8xYwJmDHCV2AfoKVk=;
	b=lBhhGBSDLDAjLTzj6d/Nmb9RIIVTA6NokJRlUEd3jLLrd3Wl+dMLz6jNq+d5fGYCZdrFSe
	qPsIMdCsbAVfi2vkcNOrHqgHhwarwRZ9xlwVoDBwGmMMEu24fCyivb0lPl91YvuqS7bSmk
	CllzQuAxt9b0dckhvTe0bj1JhqI6f57O7k6ruoJMv7/8J9WiJzq44zh5LZiR5FdYZgVZnT
	7NWMpSyzoPJblkvsz9gAWd+Rkps3sIfycFh7FsZBVtxnF3cIfEqkLXs2BrySvegS381Cl/
	5Y/sAD0Gms0lTiC80FUpv4HyP+L3ztWR2Q1qfsGAhErP0Xrsh5dE/BSLHmZppA==
ARC-Authentication-Results: i=2;
	mail.galae.net;
	dkim=pass header.d=bootlin.com header.s=dkim header.b="yyHoI/ox";
	arc=pass ("subspace.kernel.org:s=arc-20240116:i=1");
	dmarc=pass (policy=reject) header.from=bootlin.com;
	spf=pass (mail.galae.net: domain of "netdev+bounces-342830-maxime.chevallier=bootlin.com@vger.kernel.org" designates 172.105.105.114 as permitted sender) smtp.mailfrom="netdev+bounces-342830-maxime.chevallier=bootlin.com@vger.kernel.org"
ARC-Seal: i=2; s=dkim; d=bootlin.com; t=1791448718; a=rsa-sha256; cv=pass;
	b=MS0FIWql+kNXTq/h8fQduIOs7sK47/iyh5Rk8Vg5yMPNO99kGL1/qK0Rl+enKeSOTGvyxQ
	cKnxT6eWYUPPV4lgOxX5wEMywEpQMRS6rvC8QItZRYGW57r7CLenweCWD+HiU8aRFGq8r8
	qG43lScwrR2Yl6GHoyUkXzKw4geHJNpnoewBEPFin+AMNnLqQh1vTSUY1QNJlH44M33VZz
	XPhbMIKnSe2Q2rhrRbaeWoSvPKTHanY0h1ESrBCYaEOqsom1NUGtxdVcxsa2wEgoc2v9hL
	qJ7dYMEq2Kl9kFJGJ2+4TUkIIY+G3/AK0fo15Cf/FdmpdwfJbrKRbLoek+2klA==
Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by smtpin-01.galae.net (Postfix) with ESMTPS id A11B5342DD9
	for <maxime.chevallier@bootlin.com>; Thu,  8 Oct 2026 08:38:37 +0000 (UTC)
Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by tor.lore.kernel.org (Postfix) with ESMTP id 174EA2BDAA
	for <maxime.chevallier@bootlin.com>; Thu,  8 Oct 2026 08:32:22 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id C2728470E9D;
	Thu,  8 Oct 2026 08:32:20 +0000 (UTC)
X-Original-To: netdev@vger.kernel.org
Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83F3B451991
	for <netdev@vger.kernel.org>; Thu,  8 Oct 2026 08:32:16 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1791448339; cv=none; b=S/Y85t+FaTaNMBlF2npqhRjvOoTXTmRf8x3T38WNzx+RBazd5hW+kTPSIWpz7uGAiN0nIVxFlWQrh+fZYgSk6/rTKHLEtR2ErCb03l0/Q4ulPzm9QBk6WCeKvVGMk6ivJ1KGdLkt8czR4k/1EgILb9wChcczYoN/HL2W0Njdztg=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1791448339; c=relaxed/simple;
	bh=mKPxpFXIIF8Czy3FxcgFWg1HjY+yIVit76orNJybYUg=;
	h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
	 In-Reply-To:Content-Type; b=TZ+w6TKfrk7kzYC6JVZUsEq209opdLjvtmMhT123pAXVhlInJ2CiwHMrTvjSemQDhUb/QeCBB7yoXvNsDxEBiSf+yxDzWcpf3ST/mxtR/m9K7AGZ0wqF/7bgQ33FucuVI9i/hZ9C5SZuW6iC7VyAg0qwFuH4Q4QT8OSd/AoUSe8=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=yyHoI/ox; arc=none smtp.client-ip=185.246.84.56
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com
Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233])
	by smtpout-02.galae.net (Postfix) with ESMTPS id B2F391A1185;
	Thu,  8 Oct 2026 08:32:14 +0000 (UTC)
Received: from mail.galae.net (mail.galae.net [212.83.136.155])
	by smtpout-01.galae.net (Postfix) with ESMTPS id 8189360341;
	Thu,  8 Oct 2026 08:32:14 +0000 (UTC)
Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id A1E6E10333850;
	Thu,  8 Oct 2026 10:32:06 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim;
	t=1791448333; h=from:subject:date:message-id:to:cc:mime-version:content-type:
	 content-transfer-encoding:content-language:in-reply-to:references;
	bh=DKhOUStc32yyJJh2yPmsAjtT0L8xYwJmDHCV2AfoKVk=;
	b=yyHoI/oxSfdhJNEDv3/CTjikWXWJLcVViQRDKXaycfcuAlZd406+P127DWOfiugd/D3kPT
	es+l7ZPrDzzrxVzEGCjdfBHqn7srcDW5pvXitk5X0S/rgaiyKfa/KIOglKufZH+/7Jcr/1
	iVlNRIJpJJSsJfTI9eA979l45dSzZr5V3SYh7GgA44kO6BrtmjUaBJaLQ+CW6/DU1jaS8l
	4midyiJUTxJjAnIt/t7/7RoKpo8VHigd7tpdij5H1ztJ9DZHdjDjqdsI5py7gbVE8Tf4eF
	2MUU0LmXwD+78xuwBWZ2abmo8JXhrmrhTcsfEXOgsygxxCmHje1udtX2G7+HxA==
Message-ID: <85184f37-32d8-42ce-90db-46cde769ecf5@bootlin.com>
Date: Thu, 8 Oct 2026 10:32:05 +0200
Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
List-Id: <netdev.vger.kernel.org>
List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH net 09/10] net: ti: icssm-prueth: Move setting of netops
 to fix crash
To: David Yang <mmyangfl@gmail.com>, netdev@vger.kernel.org
Cc: MD Danish Anwar <danishanwar@ti.com>, Parvathi Pudi
 <parvathi@couthit.com>, Roger Quadros <rogerq@kernel.org>,
 Mohan Reddy Putluru <pmohan@couthit.com>, Andrew Lunn
 <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>,
 Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>,
 Paolo Abeni <pabeni@redhat.com>, Jacob Keller <jacob.e.keller@intel.com>,
 Stanislav Fomichev <sdf@fomichev.me>, Nicolai Buchwitz <nb@tipi-net.de>,
 linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org
References: <20261008022656.3592191-1-mmyangfl@gmail.com>
 <20261008022656.3592191-10-mmyangfl@gmail.com>
Content-Language: en-US
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
In-Reply-To: <20261008022656.3592191-10-mmyangfl@gmail.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Last-TLS-Session-Version: TLSv1.3
X-Last-TLS-Session-Version: TLSv1.3
X-Spamd-Result: default: False [-5.25 / 30.00];
	BAYES_HAM(-3.17)[93.35%];
	SUSPICIOUS_RECIPS(1.50)[];
	IP_REPUTATION_HAM(-1.41)[asn: 63949(-0.40), country: SG(-0.01), ip: 172.105.105.114(-1.00)];
	ARC_ALLOW(-1.00)[subspace.kernel.org:s=arc-20240116:i=1];
	DMARC_POLICY_ALLOW(-0.50)[bootlin.com,reject];
	R_DKIM_ALLOW(-0.20)[bootlin.com:s=dkim];
	R_SPF_ALLOW(-0.20)[+ip4:172.105.105.114:c];
	MAILLIST(-0.15)[generic];
	MIME_GOOD(-0.10)[text/plain];
	HAS_LIST_UNSUB(-0.01)[];
	MX_GOOD(-0.01)[];
	RECEIVED_HELO_LOCALHOST(0.00)[];
	URIBL_BLOCKED(0.00)[bootlin.com:mid,bootlin.com:email,bootlin.com:dkim,tor.lore.kernel.org:helo,tor.lore.kernel.org:rdns];
	RCVD_TLS_LAST(0.00)[];
	RCPT_MAILCOW_DOMAIN(0.00)[bootlin.com];
	MAILCOW_DOMAIN_HEADER_FROM(0.00)[bootlin.com];
	RCPT_COUNT_TWELVE(0.00)[16];
	TO_DN_SOME(0.00)[];
	FREEMAIL_TO(0.00)[gmail.com,vger.kernel.org];
	MIME_TRACE(0.00)[0:+];
	BCC(0.00)[];
	FORGED_SENDER_MAILLIST(0.00)[];
	TAGGED_FROM(0.00)[bounces-342830-maxime.chevallier=bootlin.com];
	RBL_SENDERSCORE_REPUT_BLOCKED(0.00)[172.105.105.114:from];
	DKIM_TRACE(0.00)[bootlin.com:+];
	DNSWL_BLOCKED(0.00)[212.83.136.155:received,212.83.139.233:received,185.246.84.56:received,172.105.105.114:from,100.90.174.1:received];
	NEURAL_HAM(-0.00)[-1.000];
	PRECEDENCE_BULK(0.00)[];
	FROM_HAS_DN(0.00)[];
	FROM_NEQ_ENVFROM(0.00)[maxime.chevallier@bootlin.com,netdev@vger.kernel.org];
	ARC_SIGNED(0.00)[bootlin.com:s=dkim:i=2];
	MID_RHS_MATCH_FROM(0.00)[];
	TAGGED_RCPT(0.00)[netdev];
	FORGED_RECIPIENTS_MAILLIST(0.00)[];
	DWL_DNSWL_BLOCKED(0.00)[bootlin.com:dkim];
	ASN(0.00)[asn:63949, ipnet:172.105.96.0/20, country:SG];
	RCVD_VIA_SMTP_AUTH(0.00)[];
	EXTERNAL_RELAY_AUTHENTICATED(0.00)[];
	RCVD_COUNT_SEVEN(0.00)[7]
X-Rspamd-Queue-Id: 23E71103303A7



On 10/8/26 04:26, David Yang wrote:
> icssm_prueth_netdev_init() calls of_phy_get_and_connect() before
> ndev->netdev_ops is assigned. phy_attach_direct() ->
> phy_link_topo_add_phy() reads dev->netdev_ops through
> netdev_need_ops_lock() since the commit in question, so probing crashes
> with a NULL pointer dereference when CONFIG_NET_SHAPER is enabled.
> 
> Assign netdev_ops before the PHY attach, as was done for emac in commit
> 7c9f391ec89c ("net: emac: move setting of netops to fix crash").
> 
> Fixes: ded86da4bbb7 ("net: ethtool: relax ethnl_req_get_phydev() locking assertion")
> Signed-off-by: David Yang <mmyangfl@gmail.com>

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Thanks,

Maxime

> ---
>  drivers/net/ethernet/ti/icssm/icssm_prueth.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/ti/icssm/icssm_prueth.c b/drivers/net/ethernet/ti/icssm/icssm_prueth.c
> index b7e94244355a..b42c98e861e0 100644
> --- a/drivers/net/ethernet/ti/icssm/icssm_prueth.c
> +++ b/drivers/net/ethernet/ti/icssm/icssm_prueth.c
> @@ -1563,6 +1563,8 @@ static int icssm_prueth_netdev_init(struct prueth *prueth,
>  	}
>  	ether_addr_copy(emac->mac_addr, ndev->dev_addr);
>  
> +	ndev->netdev_ops = &emac_netdev_ops;
> +
>  	/* connect PHY */
>  	emac->phydev = of_phy_get_and_connect(ndev, eth_node,
>  					      icssm_emac_adjust_link);
> @@ -1590,7 +1592,6 @@ static int icssm_prueth_netdev_init(struct prueth *prueth,
>  	}
>  
>  	ndev->dev.of_node = eth_node;
> -	ndev->netdev_ops = &emac_netdev_ops;
>  
>  	netif_napi_add(ndev, &emac->napi, icssm_emac_napi_poll);
>  



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH net 10/10] microchip: lan865x: move setting of netops to fix crash
  2026-10-08  2:26 ` [PATCH net 10/10] microchip: lan865x: move " David Yang
@ 2026-10-08  8:32   ` Maxime Chevallier
  0 siblings, 0 replies; 26+ messages in thread
From: Maxime Chevallier @ 2026-10-08  8:32 UTC (permalink / raw)
  To: David Yang, netdev
  Cc: Parthiban Veerasooran, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Nicolai Buchwitz,
	Jacob Keller, linux-kernel



On 10/8/26 04:26, David Yang wrote:
> lan865x_probe() assigns netdev_ops only after oa_tc6_init(), which
> connects the internal MAC-PHY through phy_connect_direct().
> phy_attach_direct() -> phy_link_topo_add_phy() reads dev->netdev_ops
> through netdev_need_ops_lock() since the commit in question, so probing
> crashes with a NULL pointer dereference when CONFIG_NET_SHAPER is
> enabled.
> 
> Assign netdev_ops before the PHY attach, as was done for emac in commit
> 7c9f391ec89c ("net: emac: move setting of netops to fix crash").
> 
> Fixes: ded86da4bbb7 ("net: ethtool: relax ethnl_req_get_phydev() locking assertion")
> Signed-off-by: David Yang <mmyangfl@gmail.com>

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Thanks,

Maxime

> ---
>  drivers/net/ethernet/microchip/lan865x/lan865x.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/microchip/lan865x/lan865x.c b/drivers/net/ethernet/microchip/lan865x/lan865x.c
> index 26a2761332a5..633d00857774 100644
> --- a/drivers/net/ethernet/microchip/lan865x/lan865x.c
> +++ b/drivers/net/ethernet/microchip/lan865x/lan865x.c
> @@ -346,6 +346,8 @@ static int lan865x_probe(struct spi_device *spi)
>  	spi_set_drvdata(spi, priv);
>  	INIT_WORK(&priv->multicast_work, lan865x_multicast_work_handler);
>  
> +	netdev->netdev_ops = &lan865x_netdev_ops;
> +
>  	priv->tc6 = oa_tc6_init(spi, netdev, NULL);
>  	if (!priv->tc6) {
>  		ret = -ENODEV;
> @@ -397,7 +399,6 @@ static int lan865x_probe(struct spi_device *spi)
>  
>  	netdev->if_port = IF_PORT_10BASET;
>  	netdev->irq = spi->irq;
> -	netdev->netdev_ops = &lan865x_netdev_ops;
>  	netdev->ethtool_ops = &lan865x_ethtool_ops;
>  
>  	ret = register_netdev(netdev);


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH net 01/10] net: hisilicon: hisi_femac: Move setting of netops to fix crash
  2026-10-08  2:26 ` [PATCH net 01/10] net: hisilicon: hisi_femac: " David Yang
  2026-10-08  8:29   ` Maxime Chevallier
@ 2026-10-08 11:51   ` Jijie Shao
  1 sibling, 0 replies; 26+ messages in thread
From: Jijie Shao @ 2026-10-08 11:51 UTC (permalink / raw)
  To: David Yang, netdev
  Cc: shaojijie, Jian Shen, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Nicolai Buchwitz, Maxime Chevallier,
	Stanislav Fomichev, linux-kernel


on 2026/10/8 10:26, David Yang wrote:
> hisi_femac_drv_probe() connects the PHY before dev->netdev_ops is
> assigned. phy_attach_direct() -> phy_link_topo_add_phy() reads
> dev->netdev_ops through netdev_need_ops_lock() since the commit in
> question, so probing crashes with a NULL pointer dereference when
> CONFIG_NET_SHAPER is enabled.
>
>    phy_link_topo_add_phy from phy_attach_direct+0xec/0x37c
>    of_phy_get_and_connect from hisi_femac_drv_probe+0x1f4/0x558
>    Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
>
> Assign netdev_ops before the PHY attach, as was done for emac in commit
> 7c9f391ec89c ("net: emac: move setting of netops to fix crash").
>
> Fixes: ded86da4bbb7 ("net: ethtool: relax ethnl_req_get_phydev() locking assertion")
> Signed-off-by: David Yang <mmyangfl@gmail.com>

Reviewed-by: Jijie Shao <shaojijie@huawei.com>

If possible, modify this file as well. I have observed similar issues on the hibmcge driver recently:
drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c

There are similar issues:
The driver assigns netdev_ops after hbg_init(), but hbg_init() calls
hbg_mdio_init() -> hbg_phy_connect() -> phy_connect_direct() ->
phy_attach_direct() -> phy_link_topo_add_phy(), which invokes
netdev_need_ops_lock(). With CONFIG_NET_SHAPER enabled, this function
dereferences dev->netdev_ops->net_shaper_ops. Since netdev_ops is still
NULL at this point, a NULL pointer dereference occurs.

Move the netdev_ops assignment before hbg_init() so that
netdev_need_ops_lock() can safely access netdev_ops during PHY
attachment.

Thanks,
Jijie Shao

> ---
>   drivers/net/ethernet/hisilicon/hisi_femac.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/hisilicon/hisi_femac.c b/drivers/net/ethernet/hisilicon/hisi_femac.c
> index d244a40df430..016605e86f0b 100644
> --- a/drivers/net/ethernet/hisilicon/hisi_femac.c
> +++ b/drivers/net/ethernet/hisilicon/hisi_femac.c
> @@ -830,6 +830,8 @@ static int hisi_femac_drv_probe(struct platform_device *pdev)
>   		hisi_femac_phy_reset(priv);
>   	}
>   
> +	ndev->netdev_ops = &hisi_femac_netdev_ops;
> +
>   	phy = of_phy_get_and_connect(ndev, node, hisi_femac_adjust_link);
>   	if (!phy) {
>   		dev_err(dev, "connect to PHY failed!\n");
> @@ -850,7 +852,6 @@ static int hisi_femac_drv_probe(struct platform_device *pdev)
>   
>   	ndev->watchdog_timeo = 6 * HZ;
>   	ndev->priv_flags |= IFF_UNICAST_FLT;
> -	ndev->netdev_ops = &hisi_femac_netdev_ops;
>   	ndev->ethtool_ops = &hisi_femac_ethtools_ops;
>   	netif_napi_add_weight(ndev, &priv->napi, hisi_femac_poll,
>   			      FEMAC_POLL_WEIGHT);

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH net 00/10] net: Move setting of netops to fix crash
  2026-10-08  2:26 [PATCH net 00/10] net: Move setting of netops to fix crash David Yang
                   ` (9 preceding siblings ...)
  2026-10-08  2:26 ` [PATCH net 10/10] microchip: lan865x: move " David Yang
@ 2026-10-08 12:10 ` Jijie Shao
  10 siblings, 0 replies; 26+ messages in thread
From: Jijie Shao @ 2026-10-08 12:10 UTC (permalink / raw)
  To: David Yang, netdev
  Cc: shaojijie, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Andreas Färber,
	Manivannan Sadhasivam, Ciprian Regus, Andreas Larsson, Jian Shen,
	Sebastian Hesselbarth, Parthiban Veerasooran, MD Danish Anwar,
	Parvathi Pudi, Roger Quadros, Mohan Reddy Putluru, Runyu Xiao,
	Simon Horman, Jacob Keller, Stanislav Fomichev, Nicolai Buchwitz,
	Maxime Chevallier, linux-arm-kernel, linux-actions, linux-kernel


on 2026/10/8 10:26, David Yang wrote:
> Commit ded86da4bbb7 ("net: ethtool: relax ethnl_req_get_phydev()
> locking assertion") put a netdev_need_ops_lock() check on the
> phy_attach_direct() path, in phy_link_topo_add_phy(). With
> CONFIG_NET_SHAPER enabled netdev_need_ops_lock() reads
> dev->netdev_ops->net_shaper_ops, so any driver that connects a PHY
> before assigning ndev->netdev_ops now dies with a NULL pointer
> dereference at probe time. The breakage showed up in v7.3-rc1.
>
> ibm/emac was hit first and fixed by commit 7c9f391ec89c ("net: emac:
> move setting of netops to fix crash"). These ten patches apply the
> same one-line move to the remaining in-tree drivers whose probe path
> attaches a PHY before filling in netdev_ops:
>
>    1. hisilicon/hisi_femac   (crash reproduced on hardware)
>    2. hisilicon/hip04
>    3. actions/owl-emac
>    4. adi/adin1140
>    5. marvell/mv643xx_eth
>    6. amd/au1000_eth
>    7. ethoc
>    8. aeroflex/greth
>    9. ti/icssm-prueth
>   10. microchip/lan865x      (attach happens inside oa_tc6_init())
>
> Only patch 1 was reproduced and verified on hardware; patches 2-10
> were found by source inspection and are neither build nor boot
> tested.
>
> Note that ti/netcp_ethss and cavium/thunder_bgx attach a PHY to
> netdevs that never get a netdev_ops at all (dummy netdevs), so they
> cannot be fixed by reordering and are not addressed here.
>
> David Yang (10):
>    net: hisilicon: hisi_femac: Move setting of netops to fix crash
>    net: hisilicon: hip04_eth: Move setting of netops to fix crash
>    net: ethernet: actions: Move setting of netops to fix crash
>    net: ethernet: adi: Move setting of netops to fix crash
>    net: mv643xx: move setting of netops to fix crash
>    net: au1000: move setting of netops to fix crash
>    net: ethoc: move setting of netops to fix crash
>    net: ethernet: aeroflex: move setting of netops to fix crash
>    net: ti: icssm-prueth: Move setting of netops to fix crash
>    microchip: lan865x: move setting of netops to fix crash

Why isn't the subject of the last patch "net: microchip: lan865x..."
But overall, it's okay.

Reviewed-by: Jijie Shao <shaojijie@huawei.com>


>
>   drivers/net/ethernet/actions/owl-emac.c          | 3 ++-
>   drivers/net/ethernet/adi/adin1140.c              | 3 ++-
>   drivers/net/ethernet/aeroflex/greth.c            | 3 ++-
>   drivers/net/ethernet/amd/au1000_eth.c            | 3 ++-
>   drivers/net/ethernet/ethoc.c                     | 3 ++-
>   drivers/net/ethernet/hisilicon/hip04_eth.c       | 3 ++-
>   drivers/net/ethernet/hisilicon/hisi_femac.c      | 3 ++-
>   drivers/net/ethernet/marvell/mv643xx_eth.c       | 4 ++--
>   drivers/net/ethernet/microchip/lan865x/lan865x.c | 3 ++-
>   drivers/net/ethernet/ti/icssm/icssm_prueth.c     | 3 ++-
>   10 files changed, 20 insertions(+), 11 deletions(-)
>

^ permalink raw reply	[flat|nested] 26+ messages in thread

* RE: [PATCH net 04/10] net: ethernet: adi: Move setting of netops to fix crash
  2026-10-08  2:26 ` [PATCH net 04/10] net: ethernet: adi: " David Yang
  2026-10-08  8:30   ` Maxime Chevallier
@ 2026-10-09 13:03   ` Regus, Ciprian
  1 sibling, 0 replies; 26+ messages in thread
From: Regus, Ciprian @ 2026-10-09 13:03 UTC (permalink / raw)
  To: David Yang, netdev
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Stanislav Fomichev, Nicolai Buchwitz,
	Maxime Chevallier, linux-kernel

> adin1140_probe() calls adin1140_phy_init(), which connects the PHY,
> before netdev->netdev_ops is assigned. phy_attach_direct() ->
> phy_link_topo_add_phy() reads dev->netdev_ops through
> netdev_need_ops_lock() since the commit in question, so probing crashes
> with a NULL pointer dereference when CONFIG_NET_SHAPER is enabled.
> 
> Assign netdev_ops before the PHY attach, as was done for emac in commit
> 7c9f391ec89c ("net: emac: move setting of netops to fix crash").
> 
> Fixes: ded86da4bbb7 ("net: ethtool: relax ethnl_req_get_phydev() locking
> assertion")
> Signed-off-by: David Yang <mmyangfl@gmail.com>

Reviewed-by: Ciprian Regus <ciprian.regus@analog.com>

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH net 08/10] net: ethernet: aeroflex: move setting of netops to fix crash
  2026-10-08  2:26 ` [PATCH net 08/10] net: ethernet: aeroflex: " David Yang
  2026-10-08  8:31   ` Maxime Chevallier
@ 2026-10-09 14:34   ` Andreas Larsson
  1 sibling, 0 replies; 26+ messages in thread
From: Andreas Larsson @ 2026-10-09 14:34 UTC (permalink / raw)
  To: David Yang, netdev
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Maxime Chevallier, Jacob Keller, Stanislav Fomichev,
	linux-kernel

On 2026-10-08 04:26, David Yang wrote:
> greth_of_probe() calls greth_mdio_init(), which connects the PHY,
> before dev->netdev_ops is assigned. phy_attach_direct() ->
> phy_link_topo_add_phy() reads dev->netdev_ops through
> netdev_need_ops_lock() since the commit in question, so probing crashes
> with a NULL pointer dereference when CONFIG_NET_SHAPER is enabled.
> 
> Assign netdev_ops before the PHY attach, as was done for emac in commit
> 7c9f391ec89c ("net: emac: move setting of netops to fix crash").
> 
> Fixes: ded86da4bbb7 ("net: ethtool: relax ethnl_req_get_phydev() locking assertion")
> Signed-off-by: David Yang <mmyangfl@gmail.com>
> ---
>  drivers/net/ethernet/aeroflex/greth.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c
> index a593adc16c78..fccb67beebee 100644
> --- a/drivers/net/ethernet/aeroflex/greth.c
> +++ b/drivers/net/ethernet/aeroflex/greth.c
> @@ -1421,6 +1421,8 @@ static int greth_of_probe(struct platform_device *ofdev)
>  	/* Check if MAC can handle MDIO interrupts */
>  	greth->mdio_int_en = (tmp >> 26) & 1;
>  
> +	dev->netdev_ops = &greth_netdev_ops;
> +
>  	err = greth_mdio_init(greth);
>  	if (err) {
>  		if (netif_msg_probe(greth))
> @@ -1498,7 +1500,6 @@ static int greth_of_probe(struct platform_device *ofdev)
>  		dev->flags &= ~IFF_MULTICAST;
>  	}
>  
> -	dev->netdev_ops = &greth_netdev_ops;
>  	dev->ethtool_ops = &greth_ethtool_ops;
>  
>  	err = register_netdev(dev);

Acked-by: Andreas Larsson <andreas@gaisler.com>

Thanks,
Andreas


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH net 05/10] net: mv643xx: move setting of netops to fix crash
  2026-10-08  2:26 ` [PATCH net 05/10] net: mv643xx: move " David Yang
@ 2026-10-13 10:00   ` Daniel Machon
  0 siblings, 0 replies; 26+ messages in thread
From: Daniel Machon @ 2026-10-13 10:00 UTC (permalink / raw)
  To: David Yang
  Cc: netdev, Sebastian Hesselbarth, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Stanislav Fomichev,
	Nicolai Buchwitz, Jacob Keller, linux-kernel

> mv643xx_eth_probe() connects the PHY before dev->netdev_ops is
> assigned. phy_attach_direct() -> phy_link_topo_add_phy() reads
> dev->netdev_ops through netdev_need_ops_lock() since the commit in
> question, so probing crashes with a NULL pointer dereference when
> CONFIG_NET_SHAPER is enabled.
> 
> Assign netdev_ops before the PHY attach, as was done for emac in commit
> 7c9f391ec89c ("net: emac: move setting of netops to fix crash").

Reviewed-by: Daniel Machon <daniel.machon@microchip.com>

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH net 07/10] net: ethoc: move setting of netops to fix crash
  2026-10-08  2:26 ` [PATCH net 07/10] net: ethoc: " David Yang
  2026-10-08  8:31   ` Maxime Chevallier
@ 2026-10-13 10:00   ` Daniel Machon
  1 sibling, 0 replies; 26+ messages in thread
From: Daniel Machon @ 2026-10-13 10:00 UTC (permalink / raw)
  To: David Yang
  Cc: netdev, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Maxime Chevallier,
	Stanislav Fomichev, Jacob Keller, linux-kernel

> ethoc_probe() calls ethoc_mdio_probe(), which connects the PHY,
> before netdev->netdev_ops is assigned. phy_attach_direct() ->
> phy_link_topo_add_phy() reads dev->netdev_ops through
> netdev_need_ops_lock() since the commit in question, so probing crashes
> with a NULL pointer dereference when CONFIG_NET_SHAPER is enabled.
> 
> Assign netdev_ops before the PHY attach, as was done for emac in commit
> 7c9f391ec89c ("net: emac: move setting of netops to fix crash").

Reviewed-by: Daniel Machon <daniel.machon@microchip.com>

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2026-10-13 17:56 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-08  2:26 [PATCH net 00/10] net: Move setting of netops to fix crash David Yang
2026-10-08  2:26 ` [PATCH net 01/10] net: hisilicon: hisi_femac: " David Yang
2026-10-08  8:29   ` Maxime Chevallier
2026-10-08 11:51   ` Jijie Shao
2026-10-08  2:26 ` [PATCH net 02/10] net: hisilicon: hip04_eth: " David Yang
2026-10-08  8:30   ` Maxime Chevallier
2026-10-08  2:26 ` [PATCH net 03/10] net: ethernet: actions: " David Yang
2026-10-08  8:30   ` Maxime Chevallier
2026-10-08  2:26 ` [PATCH net 04/10] net: ethernet: adi: " David Yang
2026-10-08  8:30   ` Maxime Chevallier
2026-10-09 13:03   ` Regus, Ciprian
2026-10-08  2:26 ` [PATCH net 05/10] net: mv643xx: move " David Yang
2026-10-13 10:00   ` Daniel Machon
2026-10-08  2:26 ` [PATCH net 06/10] net: au1000: " David Yang
2026-10-08  8:31   ` Maxime Chevallier
2026-10-08  2:26 ` [PATCH net 07/10] net: ethoc: " David Yang
2026-10-08  8:31   ` Maxime Chevallier
2026-10-13 10:00   ` Daniel Machon
2026-10-08  2:26 ` [PATCH net 08/10] net: ethernet: aeroflex: " David Yang
2026-10-08  8:31   ` Maxime Chevallier
2026-10-09 14:34   ` Andreas Larsson
2026-10-08  2:26 ` [PATCH net 09/10] net: ti: icssm-prueth: Move " David Yang
2026-10-08  8:32   ` Maxime Chevallier
2026-10-08  2:26 ` [PATCH net 10/10] microchip: lan865x: move " David Yang
2026-10-08  8:32   ` Maxime Chevallier
2026-10-08 12:10 ` [PATCH net 00/10] net: Move " Jijie Shao

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®