summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorDoug Ledford <dledford@redhat.com>2015-07-09 16:16:12 +0200
committerDoug Ledford <dledford@redhat.com>2015-07-14 19:20:15 +0200
commit9bbf282da87294e1bda0ccb4e351bfdf5fc076cd (patch)
tree7a30b55fc8a4cf4ab9c7d1433f1b2f584d05de7b /drivers/infiniband
parentIB/mlx4: Optimize freeing of items on error unwind (diff)
downloadlinux-9bbf282da87294e1bda0ccb4e351bfdf5fc076cd.tar.xz
linux-9bbf282da87294e1bda0ccb4e351bfdf5fc076cd.zip
IB/mlx4: Fix memory leak in do_slave_init
We create a number of work structs to be queued up to a workqueue, and on completion of the workqueue handler, the workqueue handler frees the allocated memory. If, however, we don't queue the work struct because the device is going down, then we need to free the memory ourselves. Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/hw/mlx4/main.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index 064454aee863..1c59e4749736 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -2692,6 +2692,8 @@ static void do_slave_init(struct mlx4_ib_dev *ibdev, int slave, int do_init)
spin_lock_irqsave(&ibdev->sriov.going_down_lock, flags);
if (!ibdev->sriov.is_going_down)
queue_work(ibdev->sriov.demux[i].ud_wq, &dm[i]->work);
+ else
+ kfree(dm[i]);
spin_unlock_irqrestore(&ibdev->sriov.going_down_lock, flags);
}
out: