Make sure to release the iwcm pointer that is allocated in qedr_iw_register_device() but never released. Fixes: e6a38c54faf3 ("RDMA/qedr: Add support for registering an iWARP device") Signed-off-by: Kamal Heib <kamalheib1@xxxxxxxxx> --- drivers/infiniband/hw/qedr/main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/qedr/main.c b/drivers/infiniband/hw/qedr/main.c index 996d9ecd93e0..567f55178379 100644 --- a/drivers/infiniband/hw/qedr/main.c +++ b/drivers/infiniband/hw/qedr/main.c @@ -293,7 +293,13 @@ static int qedr_register_device(struct qedr_dev *dev) ib_set_device_ops(&dev->ibdev, &qedr_dev_ops); dev->ibdev.driver_id = RDMA_DRIVER_QEDR; - return ib_register_device(&dev->ibdev, "qedr%d"); + rc = ib_register_device(&dev->ibdev, "qedr%d"); + if (rc) { + if (IS_IWARP(dev)) + kfree(dev->ibdev.iwcm); + } + + return rc; } /* This function allocates fast-path status block memory */ @@ -937,6 +943,8 @@ static void qedr_remove(struct qedr_dev *dev) * of the registered clients. */ ib_unregister_device(&dev->ibdev); + if (IS_IWARP(dev)) + kfree(dev->ibdev.iwcm); qedr_stop_hw(dev); qedr_sync_free_irqs(dev); -- 2.20.1