Subject: Re: kernel panic with b44 and netifd

From: Peter Münster <[email-masked]>
Date: Wed, 03 Apr 2024 17:50:24 +0200

On Wed, Apr 03 2024, Michael Chan wrote:

> please post the patch to netdev for review.

Ok, please find it here attached.

And please consider also KanjiMonster’s comment here:
https://github.com/openwrt/openwrt/issues/13789#issuecomment-2034601851

-- 
           Peter
--- build_dir/target-mipsel_mips32_musl/linux-bcm47xx_legacy/linux-5.15.153/drivers/net/ethernet/broadcom/b44.c~	2024-04-03 10:04:09.177021530 +0200
+++ build_dir/target-mipsel_mips32_musl/linux-bcm47xx_legacy/linux-5.15.153/drivers/net/ethernet/broadcom/b44.c	2024-04-03 10:46:42.267884445 +0200
@@ -2056,12 +2056,14 @@
 		bp->flags |= B44_FLAG_TX_PAUSE;
 	else
 		bp->flags &= ~B44_FLAG_TX_PAUSE;
-	if (bp->flags & B44_FLAG_PAUSE_AUTO) {
-		b44_halt(bp);
-		b44_init_rings(bp);
-		b44_init_hw(bp, B44_FULL_RESET);
-	} else {
-		__b44_set_flow_ctrl(bp, bp->flags);
+	if (netif_running(dev)) {
+		if (bp->flags & B44_FLAG_PAUSE_AUTO) {
+			b44_halt(bp);
+			b44_init_rings(bp);
+			b44_init_hw(bp, B44_FULL_RESET);
+		} else {
+			__b44_set_flow_ctrl(bp, bp->flags);
+		}
 	}
 	spin_unlock_irq(&bp->lock);