diff options
author | Yevgeny Petrilin <yevgenyp@mellanox.co.il> | 2011-04-06 23:25:45 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-07 20:36:13 -0700 |
commit | 60b1809f7e2ea2620aa548e1c866066756bdd1d2 (patch) | |
tree | 79ab74bbcd1bdb2232bb750a3236baee298d41bb | |
parent | ab6dc30da55d262c54ae12e47e4a2e4372e39fbf (diff) | |
download | linux-60b1809f7e2ea2620aa548e1c866066756bdd1d2.tar.bz2 |
mlx4_en: Restoring RX buffer pointer in case of failure
If not done, second attempt to open the RX ring would cause memory corruption.
Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/mlx4/en_rx.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/mlx4/en_rx.c b/drivers/net/mlx4/en_rx.c index 05998ee297c9..98d4ce04f86f 100644 --- a/drivers/net/mlx4/en_rx.c +++ b/drivers/net/mlx4/en_rx.c @@ -345,6 +345,8 @@ int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv) err = mlx4_en_init_allocator(priv, ring); if (err) { en_err(priv, "Failed initializing ring allocator\n"); + if (ring->stride <= TXBB_SIZE) + ring->buf -= TXBB_SIZE; ring_ind--; goto err_allocator; } @@ -369,6 +371,8 @@ err_buffers: ring_ind = priv->rx_ring_num - 1; err_allocator: while (ring_ind >= 0) { + if (priv->rx_ring[ring_ind].stride <= TXBB_SIZE) + priv->rx_ring[ring_ind].buf -= TXBB_SIZE; mlx4_en_destroy_allocator(priv, &priv->rx_ring[ring_ind]); ring_ind--; } |