mlx4: FIX error flow when initializing EQ table
authorYevgeny Petrilin <yevgenyp@mellanox.co.il>
Mon, 8 Jun 2009 07:39:58 +0000 (00:39 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 Jun 2009 07:39:58 +0000 (00:39 -0700)
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 <yevgenyp@mellanox.co.il>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/mlx4/eq.c

index 8830dcb92ec8b9c9348f00c8aa1ec4bddbad3e30..dee188761a3cad79031985301c5b945f2bae2f8e 100644 (file)
@@ -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,