]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 5 Oct 2019 11:14:01 +0000 (13:14 +0200)
commit 5d44adebbb7e785939df3db36ac360f5e8b73e44 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/hw/mlx5/main.c

index 9ab276a8bc81a2c3bd414d4aa7f915453d363619..ff6a2b1fa8b69c26e0849df7aae0f47c62d721df 100644 (file)
@@ -6829,6 +6829,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;
        }