Skip to content
/ linux Public

Commit da8eaa7

Browse files
jgunthorpegregkh
authored andcommitted
IB/mthca: Add missed mthca_unmap_user_db() for mthca_create_srq()
commit 117942c upstream. Fix a user triggerable leak on the system call failure path. Cc: stable@vger.kernel.org Fixes: ec34a92 ("[PATCH] IB/mthca: Add SRQ implementation") Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://patch.msgid.link/2-v1-83e918d69e73+a9-rdma_udata_rc_jgg@nvidia.com Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f5d8af6 commit da8eaa7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/infiniband/hw/mthca/mthca_provider.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,8 @@ static int mthca_create_srq(struct ib_srq *ibsrq,
428428

429429
if (context && ib_copy_to_udata(udata, &srq->srqn, sizeof(__u32))) {
430430
mthca_free_srq(to_mdev(ibsrq->device), srq);
431+
mthca_unmap_user_db(to_mdev(ibsrq->device), &context->uar,
432+
context->db_tab, ucmd.db_index);
431433
return -EFAULT;
432434
}
433435

@@ -436,6 +438,7 @@ static int mthca_create_srq(struct ib_srq *ibsrq,
436438

437439
static int mthca_destroy_srq(struct ib_srq *srq, struct ib_udata *udata)
438440
{
441+
mthca_free_srq(to_mdev(srq->device), to_msrq(srq));
439442
if (udata) {
440443
struct mthca_ucontext *context =
441444
rdma_udata_to_drv_context(
@@ -446,8 +449,6 @@ static int mthca_destroy_srq(struct ib_srq *srq, struct ib_udata *udata)
446449
mthca_unmap_user_db(to_mdev(srq->device), &context->uar,
447450
context->db_tab, to_msrq(srq)->db_index);
448451
}
449-
450-
mthca_free_srq(to_mdev(srq->device), to_msrq(srq));
451452
return 0;
452453
}
453454

0 commit comments

Comments
 (0)