Skip to content

Commit 1aeede3

Browse files
p-mgregkh
authored andcommitted
net: b44: set pause params only when interface is up
commit e3eb7dd upstream. 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: 1da177e (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]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f5417ff commit 1aeede3

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
@@ -2033,12 +2033,14 @@ static int b44_set_pauseparam(struct net_device *dev,
20332033
bp->flags |= B44_FLAG_TX_PAUSE;
20342034
else
20352035
bp->flags &= ~B44_FLAG_TX_PAUSE;
2036-
if (bp->flags & B44_FLAG_PAUSE_AUTO) {
2037-
b44_halt(bp);
2038-
b44_init_rings(bp);
2039-
b44_init_hw(bp, B44_FULL_RESET);
2040-
} else {
2041-
__b44_set_flow_ctrl(bp, bp->flags);
2036+
if (netif_running(dev)) {
2037+
if (bp->flags & B44_FLAG_PAUSE_AUTO) {
2038+
b44_halt(bp);
2039+
b44_init_rings(bp);
2040+
b44_init_hw(bp, B44_FULL_RESET);
2041+
} else {
2042+
__b44_set_flow_ctrl(bp, bp->flags);
2043+
}
20422044
}
20432045
spin_unlock_irq(&bp->lock);
20442046

0 commit comments

Comments
 (0)