Skip to content

Commit fdb25de

Browse files
p-mNipaLocal
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: 1da177e (Linux-2.6.12-rc2) Cc: stable@vger.kernel.org Reported-by: Peter Münster <pm@a16n.net> Suggested-by: Jonas Gorski <jonas.gorski@gmail.com> Signed-off-by: Vaclav Svoboda <svoboda@neng.cz> Tested-by: Peter Münster <pm@a16n.net> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Peter Münster <pm@a16n.net> Reviewed-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: NipaLocal <nipa@local>
1 parent 78baf30 commit fdb25de

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)