Skip to content

Commit 388617f

Browse files
jgunthorpegregkh
authored andcommitted
RDMA/mlx4: Fix resource leak on error in mlx4_ib_create_srq()
commit c54c7e4 upstream. Sashiko points out that mlx4_srq_alloc() was not undone during error unwind, add the missing call to mlx4_srq_free(). Cc: stable@vger.kernel.org Fixes: 225c7b1 ("IB/mlx4: Add a driver Mellanox ConnectX InfiniBand adapters") Link: https://sashiko.dev/#/patchset/0-v1-e911b76a94d1%2B65d95-rdma_udata_rep_jgg%40nvidia.com?part=8 Link: https://patch.msgid.link/r/11-v1-41f3135e5565+9d2-rdma_ai_fixes1_jgg@nvidia.com Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 8b7833f commit 388617f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

  • drivers/infiniband/hw/mlx4

drivers/infiniband/hw/mlx4/srq.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,15 @@ int mlx4_ib_create_srq(struct ib_srq *ib_srq,
193193
if (udata)
194194
if (ib_copy_to_udata(udata, &srq->msrq.srqn, sizeof (__u32))) {
195195
err = -EFAULT;
196-
goto err_wrid;
196+
goto err_srq;
197197
}
198198

199199
init_attr->attr.max_wr = srq->msrq.max - 1;
200200

201201
return 0;
202202

203+
err_srq:
204+
mlx4_srq_free(dev->dev, &srq->msrq);
203205
err_wrid:
204206
if (udata)
205207
mlx4_ib_db_unmap_user(ucontext, &srq->db);

0 commit comments

Comments
 (0)