mlx4_core: Avoid double free_icms
authorYevgeny Petrilin <yevgenyp@mellanox.co.il>
Sun, 6 Sep 2009 03:24:49 +0000 (20:24 -0700)
committerRoland Dreier <rolandd@cisco.com>
Sun, 6 Sep 2009 03:24:49 +0000 (20:24 -0700)
On the error path of mlx4_init_hca(), mlx4_close_hca() is called,
followed by mlx4_free_icms() and mlx4_UNMAP_FA().  But both those
functions are also called from mlx4_close_hca(), which leads to a
double free.

Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/net/mlx4/main.c

index 528f89b2cde333e5eaab68df84bb5fb8c5e2e967..3dd481e77f92f1f5cff4af9cfd9d9975439520af 100644 (file)
@@ -789,7 +789,7 @@ static int mlx4_init_hca(struct mlx4_dev *dev)
        return 0;
 
 err_close:
-       mlx4_close_hca(dev);
+       mlx4_CLOSE_HCA(dev, 0);
 
 err_free_icm:
        mlx4_free_icms(dev);