]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
IB/mlx5: Free mpi in mp_slave mode
authorDanit Goldberg <danitg@mellanox.com>
Mon, 16 Sep 2019 06:48:18 +0000 (09:48 +0300)
committerJason Gunthorpe <jgg@mellanox.com>
Mon, 16 Sep 2019 17:08:18 +0000 (14:08 -0300)
ib_add_slave_port() allocates a multiport struct but never frees it.
Don't leak memory, free the allocated mpi struct during driver unload.

Cc: <stable@vger.kernel.org>
Fixes: 32f69e4be269 ("{net, IB}/mlx5: Manage port association for multiport RoCE")
Link: https://lore.kernel.org/r/20190916064818.19823-3-leon@kernel.org
Signed-off-by: Danit Goldberg <danitg@mellanox.com>
Reviewed-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/mlx5/main.c

index c6bc4aee76382cfc1d8c5998fe127ff5e7cabad5..6fedfff7862a654eec30920fee48a41c65b89bec 100644 (file)
@@ -6999,6 +6999,7 @@ static void mlx5_ib_remove(struct mlx5_core_dev *mdev, void *context)
                        mlx5_ib_unbind_slave_port(mpi->ibdev, mpi);
                list_del(&mpi->list);
                mutex_unlock(&mlx5_ib_multiport_mutex);
+               kfree(mpi);
                return;
        }