]> err.no Git - linux-2.6/commitdiff
[PATCH] skge: handle out of memory on ring parameter change
authorStephen Hemminger <shemminger@osdl.org>
Wed, 14 Dec 2005 23:47:48 +0000 (15:47 -0800)
committerJeff Garzik <jgarzik@pobox.com>
Sat, 24 Dec 2005 14:36:06 +0000 (09:36 -0500)
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>
drivers/net/skge.c

index 96b661b1f6c0e450034be6a02d2f188da9044433..9ff54ea713cda7dee648b62233658fbddffa73df 100644 (file)
@@ -397,6 +397,7 @@ static int skge_set_ring_param(struct net_device *dev,
                               struct ethtool_ringparam *p)
 {
        struct skge_port *skge = netdev_priv(dev);
+       int err;
 
        if (p->rx_pending == 0 || p->rx_pending > MAX_RX_RING_SIZE ||
            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,
 
        if (netif_running(dev)) {
                skge_down(dev);
-               skge_up(dev);
+               err = skge_up(dev);
+               if (err)
+                       dev_close(dev);
        }
 
        return 0;