Commit c54c7e4c authored by Jason Gunthorpe's avatar Jason Gunthorpe
Browse files

RDMA/mlx4: Fix resource leak on error in mlx4_ib_create_srq()

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: 225c7b1f ("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: default avatarJason Gunthorpe <jgg@nvidia.com>
parent e38e8699
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -194,13 +194,15 @@ int mlx4_ib_create_srq(struct ib_srq *ib_srq,
	if (udata)
		if (ib_copy_to_udata(udata, &srq->msrq.srqn, sizeof (__u32))) {
			err = -EFAULT;
			goto err_wrid;
			goto err_srq;
		}

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

	return 0;

err_srq:
	mlx4_srq_free(dev->dev, &srq->msrq);
err_wrid:
	if (udata)
		mlx4_ib_db_unmap_user(ucontext, &srq->db);