Skip to content

Commit e3eb7dd

Browse files
p-mkuba-moo
authored andcommitted
net: b44: set pause params only when interface is up
b44_free_rings() accesses b44::rx_buffers (and ::tx_buffers) unconditionally, but b44::rx_buffers is only valid when the device is up (they get allocated in b44_open(), and deallocated again in b44_close()), any other time these are just a NULL pointers. So if you try to change the pause params while the network interface is disabled/administratively down, everything explodes (which likely netifd tries to do). Link: openwrt/openwrt#13789 Fixes: 1da177e4c3f4 (Linux-2.6.12-rc2) Cc: [email protected] Reported-by: Peter Münster <[email protected]> Suggested-by: Jonas Gorski <[email protected]> Signed-off-by: Vaclav Svoboda <[email protected]> Tested-by: Peter Münster <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: Peter Münster <[email protected]> Reviewed-by: Michael Chan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 0844370 commit e3eb7dd

File tree

1 file changed

+8
-6
lines changed
  • drivers/net/ethernet/broadcom

1 file changed

+8
-6
lines changed

drivers/net/ethernet/broadcom/b44.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2009,12 +2009,14 @@ static int b44_set_pauseparam(struct net_device *dev,
20092009
bp->flags |= B44_FLAG_TX_PAUSE;
20102010
else
20112011
bp->flags &= ~B44_FLAG_TX_PAUSE;
2012-
if (bp->flags & B44_FLAG_PAUSE_AUTO) {
2013-
b44_halt(bp);
2014-
b44_init_rings(bp);
2015-
b44_init_hw(bp, B44_FULL_RESET);
2016-
} else {
2017-
__b44_set_flow_ctrl(bp, bp->flags);
2012+
if (netif_running(dev)) {
2013+
if (bp->flags & B44_FLAG_PAUSE_AUTO) {
2014+
b44_halt(bp);
2015+
b44_init_rings(bp);
2016+
b44_init_hw(bp, B44_FULL_RESET);
2017+
} else {
2018+
__b44_set_flow_ctrl(bp, bp->flags);
2019+
}
20182020
}
20192021
spin_unlock_irq(&bp->lock);
20202022

0 commit comments

Comments
 (0)