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

Configure Feed

Select the types of activity you want to include in your feed.

IB/mthca: Add missed mthca_unmap_user_db() for mthca_create_srq()

Fix a user triggerable leak on the system call failure path.

Cc: stable@vger.kernel.org
Fixes: ec34a922d243 ("[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>

authored by

Jason Gunthorpe and committed by
Leon Romanovsky
117942ca f22c77ce

+3 -2
+3 -2
drivers/infiniband/hw/mthca/mthca_provider.c
··· 428 428 429 429 if (context && ib_copy_to_udata(udata, &srq->srqn, sizeof(__u32))) { 430 430 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); 431 433 return -EFAULT; 432 434 } 433 435 ··· 438 436 439 437 static int mthca_destroy_srq(struct ib_srq *srq, struct ib_udata *udata) 440 438 { 439 + mthca_free_srq(to_mdev(srq->device), to_msrq(srq)); 441 440 if (udata) { 442 441 struct mthca_ucontext *context = 443 442 rdma_udata_to_drv_context( ··· 449 446 mthca_unmap_user_db(to_mdev(srq->device), &context->uar, 450 447 context->db_tab, to_msrq(srq)->db_index); 451 448 } 452 - 453 - mthca_free_srq(to_mdev(srq->device), to_msrq(srq)); 454 449 return 0; 455 450 } 456 451