Skip to content

Commit 018c4ea

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 d35fb16 commit 018c4ea

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

+8-6
Original file line numberDiff line numberDiff line change
@@ -2029,12 +2029,14 @@ static int b44_set_pauseparam(struct net_device *dev,
20292029
bp->flags |= B44_FLAG_TX_PAUSE;
20302030
else
20312031
bp->flags &= ~B44_FLAG_TX_PAUSE;
2032-
if (bp->flags & B44_FLAG_PAUSE_AUTO) {
2033-
b44_halt(bp);
2034-
b44_init_rings(bp);
2035-
b44_init_hw(bp, B44_FULL_RESET);
2036-
} else {
2037-
__b44_set_flow_ctrl(bp, bp->flags);
2032+
if (netif_running(dev)) {
2033+
if (bp->flags & B44_FLAG_PAUSE_AUTO) {
2034+
b44_halt(bp);
2035+
b44_init_rings(bp);
2036+
b44_init_hw(bp, B44_FULL_RESET);
2037+
} else {
2038+
__b44_set_flow_ctrl(bp, bp->flags);
2039+
}
20382040
}
20392041
spin_unlock_irq(&bp->lock);
20402042

0 commit comments

Comments
 (0)