diff options
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/core/uverbs_cmd.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index 12d6cc0a7f80..a02c5a05c984 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c | |||
@@ -594,13 +594,18 @@ ssize_t ib_uverbs_create_cq(struct ib_uverbs_file *file, | |||
594 | if (cmd.comp_vector >= file->device->num_comp_vectors) | 594 | if (cmd.comp_vector >= file->device->num_comp_vectors) |
595 | return -EINVAL; | 595 | return -EINVAL; |
596 | 596 | ||
597 | if (cmd.comp_channel >= 0) | ||
598 | ev_file = ib_uverbs_lookup_comp_file(cmd.comp_channel); | ||
599 | |||
600 | uobj = kmalloc(sizeof *uobj, GFP_KERNEL); | 597 | uobj = kmalloc(sizeof *uobj, GFP_KERNEL); |
601 | if (!uobj) | 598 | if (!uobj) |
602 | return -ENOMEM; | 599 | return -ENOMEM; |
603 | 600 | ||
601 | if (cmd.comp_channel >= 0) { | ||
602 | ev_file = ib_uverbs_lookup_comp_file(cmd.comp_channel); | ||
603 | if (!ev_file) { | ||
604 | ret = -EINVAL; | ||
605 | goto err; | ||
606 | } | ||
607 | } | ||
608 | |||
604 | uobj->uobject.user_handle = cmd.user_handle; | 609 | uobj->uobject.user_handle = cmd.user_handle; |
605 | uobj->uobject.context = file->ucontext; | 610 | uobj->uobject.context = file->ucontext; |
606 | uobj->uverbs_file = file; | 611 | uobj->uverbs_file = file; |
@@ -664,6 +669,8 @@ err_up: | |||
664 | ib_destroy_cq(cq); | 669 | ib_destroy_cq(cq); |
665 | 670 | ||
666 | err: | 671 | err: |
672 | if (ev_file) | ||
673 | ib_uverbs_release_ucq(file, ev_file, uobj); | ||
667 | kfree(uobj); | 674 | kfree(uobj); |
668 | return ret; | 675 | return ret; |
669 | } | 676 | } |