Skip to content

Commit

Permalink
[PATCH] skge: handle out of memory on ring parameter change
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stephen Hemminger authored and Jeff Garzik committed Dec 24, 2005
1 parent 2770b51 commit 3b8bb47
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/net/skge.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
Expand Down

0 comments on commit 3b8bb47

Please sign in to comment.