Commit 65159c05 authored by Bharat Potnuri's avatar Bharat Potnuri Committed by Doug Ledford

RDMA/uverbs: Initialize cq_context appropriately

Initializing cq_context with ev_queue in create_cq(), leads to NULL pointer
dereference in ib_uverbs_comp_handler(), if application doesnot use completion
channel. This patch fixes the cq_context initialization.

Fixes: 1e7710f3 ("IB/core: Change completion channel to use the reworked")
Cc: stable@vger.kernel.org # 4.12
Signed-off-by: default avatarPotnuri Bharat Teja <bharat@chelsio.com>
Reviewed-by: default avatarMatan Barak <matanb@mellanox.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
(cherry picked from commit 699a2d5b)
parent 870201f9
...@@ -1015,7 +1015,7 @@ static struct ib_ucq_object *create_cq(struct ib_uverbs_file *file, ...@@ -1015,7 +1015,7 @@ static struct ib_ucq_object *create_cq(struct ib_uverbs_file *file,
cq->uobject = &obj->uobject; cq->uobject = &obj->uobject;
cq->comp_handler = ib_uverbs_comp_handler; cq->comp_handler = ib_uverbs_comp_handler;
cq->event_handler = ib_uverbs_cq_event_handler; cq->event_handler = ib_uverbs_cq_event_handler;
cq->cq_context = &ev_file->ev_queue; cq->cq_context = ev_file ? &ev_file->ev_queue : NULL;
atomic_set(&cq->usecnt, 0); atomic_set(&cq->usecnt, 0);
obj->uobject.object = cq; obj->uobject.object = cq;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment