aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/infiniband/hw/mthca/mthca_provider.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c
index db35690c91de..484a7e6b7f8c 100644
--- a/drivers/infiniband/hw/mthca/mthca_provider.c
+++ b/drivers/infiniband/hw/mthca/mthca_provider.c
@@ -445,8 +445,10 @@ static struct ib_srq *mthca_create_srq(struct ib_pd *pd,
445 if (pd->uobject) { 445 if (pd->uobject) {
446 context = to_mucontext(pd->uobject->context); 446 context = to_mucontext(pd->uobject->context);
447 447
448 if (ib_copy_from_udata(&ucmd, udata, sizeof ucmd)) 448 if (ib_copy_from_udata(&ucmd, udata, sizeof ucmd)) {
449 return ERR_PTR(-EFAULT); 449 err = -EFAULT;
450 goto err_free;
451 }
450 452
451 err = mthca_map_user_db(to_mdev(pd->device), &context->uar, 453 err = mthca_map_user_db(to_mdev(pd->device), &context->uar,
452 context->db_tab, ucmd.db_index, 454 context->db_tab, ucmd.db_index,
@@ -522,8 +524,10 @@ static struct ib_qp *mthca_create_qp(struct ib_pd *pd,
522 if (pd->uobject) { 524 if (pd->uobject) {
523 context = to_mucontext(pd->uobject->context); 525 context = to_mucontext(pd->uobject->context);
524 526
525 if (ib_copy_from_udata(&ucmd, udata, sizeof ucmd)) 527 if (ib_copy_from_udata(&ucmd, udata, sizeof ucmd)) {
528 kfree(qp);
526 return ERR_PTR(-EFAULT); 529 return ERR_PTR(-EFAULT);
530 }
527 531
528 err = mthca_map_user_db(to_mdev(pd->device), &context->uar, 532 err = mthca_map_user_db(to_mdev(pd->device), &context->uar,
529 context->db_tab, 533 context->db_tab,