Netdev List
 help / color / mirror / Atom feed
* [PATCH net 0/2] net: sgi: ioc3-eth: two teardown fixes
@ 2026-11-16 10:19 Imre Kaloz
  2026-11-16 10:19 ` [PATCH net 1/2] net: sgi: ioc3-eth: set platform drvdata in probe Imre Kaloz
  2026-11-16 10:19 ` [PATCH net 2/2] net: sgi: ioc3-eth: fix IRQ lifetime against netdev teardown Imre Kaloz
  0 siblings, 2 replies; 3+ messages in thread
From: Imre Kaloz @ 2026-11-16 10:19 UTC (permalink / raw)
  To: Thomas Bogendoerfer, netdev
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, linux-mips, linux-kernel

Two teardown fixes for ioc3-eth: probe never stores the net_device
that remove fetches, and the shared IRQ outlives free_netdev().

Tested on an SGI Fuel.

Imre Kaloz (2):
  net: sgi: ioc3-eth: set platform drvdata in probe
  net: sgi: ioc3-eth: fix IRQ lifetime against netdev teardown

 drivers/net/ethernet/sgi/ioc3-eth.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)


base-commit: aa40afa831ebfe45e40a23721711059f2ac584d4
-- 
2.47.3


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

* [PATCH net 1/2] net: sgi: ioc3-eth: set platform drvdata in probe
  2026-11-16 10:19 [PATCH net 0/2] net: sgi: ioc3-eth: two teardown fixes Imre Kaloz
@ 2026-11-16 10:19 ` Imre Kaloz
  2026-11-16 10:19 ` [PATCH net 2/2] net: sgi: ioc3-eth: fix IRQ lifetime against netdev teardown Imre Kaloz
  1 sibling, 0 replies; 3+ messages in thread
From: Imre Kaloz @ 2026-11-16 10:19 UTC (permalink / raw)
  To: Thomas Bogendoerfer, netdev
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, linux-mips, linux-kernel, stable, Sashiko

ioc3eth_remove() fetches the net_device with platform_get_drvdata(),
but probe never stores it, so unbinding the device oopses in
unregister_netdev().

Reproduced and tested on an SGI Fuel.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/all/179473760071.2199510.16065103101920438822@kernel.org/
Cc: stable@vger.kernel.org
Signed-off-by: Imre Kaloz <kaloz@kernel.org>
---
 drivers/net/ethernet/sgi/ioc3-eth.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/sgi/ioc3-eth.c b/drivers/net/ethernet/sgi/ioc3-eth.c
index 009f37105eaf..ee284a4f75ff 100644
--- a/drivers/net/ethernet/sgi/ioc3-eth.c
+++ b/drivers/net/ethernet/sgi/ioc3-eth.c
@@ -848,6 +848,7 @@ static int ioc3eth_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	SET_NETDEV_DEV(dev, &pdev->dev);
+	platform_set_drvdata(pdev, dev);
 
 	ip = netdev_priv(dev);
 	ip->dma_dev = pdev->dev.parent;
-- 
2.47.3


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

* [PATCH net 2/2] net: sgi: ioc3-eth: fix IRQ lifetime against netdev teardown
  2026-11-16 10:19 [PATCH net 0/2] net: sgi: ioc3-eth: two teardown fixes Imre Kaloz
  2026-11-16 10:19 ` [PATCH net 1/2] net: sgi: ioc3-eth: set platform drvdata in probe Imre Kaloz
@ 2026-11-16 10:19 ` Imre Kaloz
  1 sibling, 0 replies; 3+ messages in thread
From: Imre Kaloz @ 2026-11-16 10:19 UTC (permalink / raw)
  To: Thomas Bogendoerfer, netdev
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, linux-mips, linux-kernel, stable, Sashiko

The shared IRQ is requested before the lock and timer its handler
uses are initialized, and stays registered past free_netdev() on the
probe error paths and in remove, so the handler can run on freed
memory.

Reproduced with CONFIG_DEBUG_SHIRQ=y and slub_debug=P and tested on
an SGI Fuel.

Fixes: 0ce5ebd24d25 ("mfd: ioc3: Add driver for SGI IOC3 chip")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/all/179473760071.2199510.16065103101920438822@kernel.org/
Cc: stable@vger.kernel.org
Signed-off-by: Imre Kaloz <kaloz@kernel.org>
---
 drivers/net/ethernet/sgi/ioc3-eth.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/sgi/ioc3-eth.c b/drivers/net/ethernet/sgi/ioc3-eth.c
index ee284a4f75ff..e322a588d5c4 100644
--- a/drivers/net/ethernet/sgi/ioc3-eth.c
+++ b/drivers/net/ethernet/sgi/ioc3-eth.c
@@ -870,16 +870,16 @@ static int ioc3eth_probe(struct platform_device *pdev)
 		goto out_free;
 	}
 
-	if (devm_request_irq(&pdev->dev, dev->irq, ioc3_interrupt,
-			     IRQF_SHARED, "ioc3-eth", dev)) {
+	spin_lock_init(&ip->ioc3_lock);
+	timer_setup(&ip->ioc3_timer, ioc3_timer, 0);
+
+	if (request_irq(dev->irq, ioc3_interrupt, IRQF_SHARED, "ioc3-eth",
+			dev)) {
 		dev_err(&pdev->dev, "Can't get irq %d\n", dev->irq);
 		err = -ENODEV;
 		goto out_free;
 	}
 
-	spin_lock_init(&ip->ioc3_lock);
-	timer_setup(&ip->ioc3_timer, ioc3_timer, 0);
-
 	ioc3_stop(ip);
 
 	/* Allocate rx ring.  4kb = 512 entries, must be 4kb aligned */
@@ -951,6 +951,7 @@ static int ioc3eth_probe(struct platform_device *pdev)
 	return 0;
 
 out_stop:
+	free_irq(dev->irq, dev);
 	timer_delete_sync(&ip->ioc3_timer);
 	if (ip->rxr)
 		dma_free_coherent(ip->dma_dev, RX_RING_SIZE, ip->rxr,
@@ -969,6 +970,7 @@ static void ioc3eth_remove(struct platform_device *pdev)
 	struct ioc3_private *ip = netdev_priv(dev);
 
 	unregister_netdev(dev);
+	free_irq(dev->irq, dev);
 	timer_delete_sync(&ip->ioc3_timer);
 
 	dma_free_coherent(ip->dma_dev, RX_RING_SIZE, ip->rxr, ip->rxr_dma);
-- 
2.47.3


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

end of thread, other threads:[~2026-11-16 10:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-16 10:19 [PATCH net 0/2] net: sgi: ioc3-eth: two teardown fixes Imre Kaloz
2026-11-16 10:19 ` [PATCH net 1/2] net: sgi: ioc3-eth: set platform drvdata in probe Imre Kaloz
2026-11-16 10:19 ` [PATCH net 2/2] net: sgi: ioc3-eth: fix IRQ lifetime against netdev teardown Imre Kaloz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox