82596: free resources on error
IRQ 56 was not freed anywhere (neither in i596_open() on error nor in i596_close()), rx_bufs were not freed if init_i596_mem() fails, netif_stop_queue() was not called. Signed-off-by: Kulikov Vasiliy <segooon@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
f163530407
commit
a607072b86
@@ -1015,24 +1015,35 @@ static int i596_open(struct net_device *dev)
|
|||||||
}
|
}
|
||||||
#ifdef ENABLE_MVME16x_NET
|
#ifdef ENABLE_MVME16x_NET
|
||||||
if (MACH_IS_MVME16x) {
|
if (MACH_IS_MVME16x) {
|
||||||
if (request_irq(0x56, i596_error, 0, "i82596_error", dev))
|
if (request_irq(0x56, i596_error, 0, "i82596_error", dev)) {
|
||||||
return -EAGAIN;
|
res = -EAGAIN;
|
||||||
|
goto err_irq_dev;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
res = init_rx_bufs(dev);
|
res = init_rx_bufs(dev);
|
||||||
if (res) {
|
if (res)
|
||||||
free_irq(dev->irq, dev);
|
goto err_irq_56;
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
netif_start_queue(dev);
|
netif_start_queue(dev);
|
||||||
|
|
||||||
/* Initialize the 82596 memory */
|
|
||||||
if (init_i596_mem(dev)) {
|
if (init_i596_mem(dev)) {
|
||||||
res = -EAGAIN;
|
res = -EAGAIN;
|
||||||
free_irq(dev->irq, dev);
|
goto err_queue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
err_queue:
|
||||||
|
netif_stop_queue(dev);
|
||||||
|
remove_rx_bufs(dev);
|
||||||
|
err_irq_56:
|
||||||
|
#ifdef ENABLE_MVME16x_NET
|
||||||
|
free_irq(0x56, dev);
|
||||||
|
#endif
|
||||||
|
err_irq_dev:
|
||||||
|
free_irq(dev->irq, dev);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1498,6 +1509,9 @@ static int i596_close(struct net_device *dev)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_MVME16x_NET
|
||||||
|
free_irq(0x56, dev);
|
||||||
|
#endif
|
||||||
free_irq(dev->irq, dev);
|
free_irq(dev->irq, dev);
|
||||||
remove_rx_bufs(dev);
|
remove_rx_bufs(dev);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user