Commit 3a088cb0 authored by Ben Hutchings's avatar Ben Hutchings Committed by Greg Kroah-Hartman

via-velocity: Give RX descriptors to the NIC later on open or MTU change

commit 35bb5cad upstream.

velocity_open() calls velocity_give_many_rx_descs(), which gives RX
descriptors to the NIC, before installing an interrupt handler or
calling velocity_init_registers().  I think this is very unsafe and it
appears to explain the bug report <http://bugs.debian.org/508527>.

On MTU change, velocity_give_many_rx_descs() is again called before
velocity_init_registers().  I'm not sure whether this is unsafe but
it does look wrong.

Therefore, move the calls to velocity_give_many_rx_descs() after
request_irq() and velocity_init_registers().
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
Tested-by: default avatarJan Ceuleers <jan.ceuleers@computer.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 94df9bd3
...@@ -2186,8 +2186,6 @@ static int velocity_open(struct net_device *dev) ...@@ -2186,8 +2186,6 @@ static int velocity_open(struct net_device *dev)
/* Ensure chip is running */ /* Ensure chip is running */
pci_set_power_state(vptr->pdev, PCI_D0); pci_set_power_state(vptr->pdev, PCI_D0);
velocity_give_many_rx_descs(vptr);
velocity_init_registers(vptr, VELOCITY_INIT_COLD); velocity_init_registers(vptr, VELOCITY_INIT_COLD);
ret = request_irq(vptr->pdev->irq, &velocity_intr, IRQF_SHARED, ret = request_irq(vptr->pdev->irq, &velocity_intr, IRQF_SHARED,
...@@ -2199,6 +2197,8 @@ static int velocity_open(struct net_device *dev) ...@@ -2199,6 +2197,8 @@ static int velocity_open(struct net_device *dev)
goto out; goto out;
} }
velocity_give_many_rx_descs(vptr);
mac_enable_int(vptr->mac_regs); mac_enable_int(vptr->mac_regs);
netif_start_queue(dev); netif_start_queue(dev);
vptr->flags |= VELOCITY_FLAGS_OPENED; vptr->flags |= VELOCITY_FLAGS_OPENED;
...@@ -2287,10 +2287,10 @@ static int velocity_change_mtu(struct net_device *dev, int new_mtu) ...@@ -2287,10 +2287,10 @@ static int velocity_change_mtu(struct net_device *dev, int new_mtu)
dev->mtu = new_mtu; dev->mtu = new_mtu;
velocity_give_many_rx_descs(vptr);
velocity_init_registers(vptr, VELOCITY_INIT_COLD); velocity_init_registers(vptr, VELOCITY_INIT_COLD);
velocity_give_many_rx_descs(vptr);
mac_enable_int(vptr->mac_regs); mac_enable_int(vptr->mac_regs);
netif_start_queue(dev); netif_start_queue(dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment