diff options
author | Stephen Hemminger <shemminger@osdl.org> | 2005-12-14 18:47:48 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-12-24 09:36:06 -0500 |
commit | 3b8bb472ad8eee6f42bc82647ff5d6d9bfe49e20 (patch) | |
tree | a283968f8bee753cbd4be1bdbb3dcd78824c5e48 /drivers/net/skge.c | |
parent | 2770b5172e9b3d135b16d1e5d8344919ac09319d (diff) |
[PATCH] skge: handle out of memory on ring parameter change
If changing ring parameters is unable to allocate memory, we need
to return an error and take the device down.
Fixes-bug: http://bugzilla.kernel.org/show_bug.cgi?id=5715
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/net/skge.c')
-rw-r--r-- | drivers/net/skge.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 96b661b1f6c0..9ff54ea713cd 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -397,6 +397,7 @@ static int skge_set_ring_param(struct net_device *dev, | |||
397 | struct ethtool_ringparam *p) | 397 | struct ethtool_ringparam *p) |
398 | { | 398 | { |
399 | struct skge_port *skge = netdev_priv(dev); | 399 | struct skge_port *skge = netdev_priv(dev); |
400 | int err; | ||
400 | 401 | ||
401 | if (p->rx_pending == 0 || p->rx_pending > MAX_RX_RING_SIZE || | 402 | if (p->rx_pending == 0 || p->rx_pending > MAX_RX_RING_SIZE || |
402 | p->tx_pending == 0 || p->tx_pending > MAX_TX_RING_SIZE) | 403 | p->tx_pending == 0 || p->tx_pending > MAX_TX_RING_SIZE) |
@@ -407,7 +408,9 @@ static int skge_set_ring_param(struct net_device *dev, | |||
407 | 408 | ||
408 | if (netif_running(dev)) { | 409 | if (netif_running(dev)) { |
409 | skge_down(dev); | 410 | skge_down(dev); |
410 | skge_up(dev); | 411 | err = skge_up(dev); |
412 | if (err) | ||
413 | dev_close(dev); | ||
411 | } | 414 | } |
412 | 415 | ||
413 | return 0; | 416 | return 0; |