Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+2
+2
drivers/infiniband/hw/mlx4/main.c
··· 2692 2692 spin_lock_irqsave(&ibdev->sriov.going_down_lock, flags); 2693 2693 if (!ibdev->sriov.is_going_down) 2694 2694 queue_work(ibdev->sriov.demux[i].ud_wq, &dm[i]->work); 2695 + else 2696 + kfree(dm[i]); 2695 2697 spin_unlock_irqrestore(&ibdev->sriov.going_down_lock, flags); 2696 2698 } 2697 2699 out: