From: Yevgeny Petrilin Date: Mon, 8 Jun 2009 07:39:58 +0000 (-0700) Subject: mlx4: FIX error flow when initializing EQ table X-Git-Tag: v2.6.31-rc1~330^2~117 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=a5b19b635c39fdb819500b0a746b44fe40c9a303;p=~shefty%2Frdma-dev.git mlx4: FIX error flow when initializing EQ table If mlx4_create_eq() would fail for one of EQ's assigned for completion handling, the code would try to free the same EQ we failed to create. The crash was found by Christoph Lameter Signed-off-by: Yevgeny Petrilin Signed-off-by: David S. Miller --- diff --git a/drivers/net/mlx4/eq.c b/drivers/net/mlx4/eq.c index 8830dcb92ec..dee188761a3 100644 --- a/drivers/net/mlx4/eq.c +++ b/drivers/net/mlx4/eq.c @@ -623,8 +623,10 @@ int mlx4_init_eq_table(struct mlx4_dev *dev) err = mlx4_create_eq(dev, dev->caps.num_cqs + MLX4_NUM_SPARE_EQE, (dev->flags & MLX4_FLAG_MSI_X) ? i : 0, &priv->eq_table.eq[i]); - if (err) + if (err) { + --i; goto err_out_unmap; + } } err = mlx4_create_eq(dev, MLX4_NUM_ASYNC_EQE + MLX4_NUM_SPARE_EQE,