Skip to content

Commit

Permalink
IB/mlx4: Fix memory leak in do_slave_init
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Doug Ledford committed Jul 14, 2015
1 parent a39a98f commit 9bbf282
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/infiniband/hw/mlx4/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 9bbf282

Please sign in to comment.