Skip to contentSkip to conversation

mlx4_en: Restoring RX buffer pointer in case of failure

PATCH Applied Yevgeny Petrilin 2 participants 2 messages Apr 7, 2011 – Apr 8, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mlx4_en: Restoring RX buffer pointer in case of failure

If not done, second attempt to open the RX ring would cause memory corruption.

---
 drivers/net/mlx4/en_rx.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/net/mlx4/en_rx.c +4 -0
index a0423eb..33edecb 100644
@@ -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--;
 	}
Signature · 1 line
1.6.0.2