* [PATCH for-next] IB/core: Avoid a potential OOPs for an unused optional parameter
@ 2018-02-01 20:31 Dennis Dalessandro
2018-02-01 22:52 ` Jason Gunthorpe
0 siblings, 1 reply; 2+ messages in thread
From: Dennis Dalessandro @ 2018-02-01 20:31 UTC (permalink / raw)
To: jgg, dledford; +Cc: linux-rdma, Michael J. Ruhl, Ira Weiny, stable
From: Michael J. Ruhl <michael.j.ruhl@intel.com>
The ev_file is an optional parameter for CQ creation. If the parameter
is not passed, the ev_file pointer will be NULL. Using that pointer
to set the cq_context will result in an OOPs.
Verify that ev_file is not NULL before using.
Cc: <stable@vger.kernel.org> # 4.14.x
Fixes: 9ee79fce3642 ("IB/core: Add completion queue (cq) object actions")
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
---
drivers/infiniband/core/uverbs_std_types.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/infiniband/core/uverbs_std_types.c b/drivers/infiniband/core/uverbs_std_types.c
index b571176..cab0ac3 100644
--- a/drivers/infiniband/core/uverbs_std_types.c
+++ b/drivers/infiniband/core/uverbs_std_types.c
@@ -316,7 +316,7 @@ static int uverbs_create_cq_handler(struct ib_device *ib_dev,
cq->uobject = &obj->uobject;
cq->comp_handler = ib_uverbs_comp_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;
obj->uobject.object = cq;
obj->uobject.user_handle = user_handle;
atomic_set(&cq->usecnt, 0);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH for-next] IB/core: Avoid a potential OOPs for an unused optional parameter
2018-02-01 20:31 [PATCH for-next] IB/core: Avoid a potential OOPs for an unused optional parameter Dennis Dalessandro
@ 2018-02-01 22:52 ` Jason Gunthorpe
0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2018-02-01 22:52 UTC (permalink / raw)
To: Dennis Dalessandro
Cc: dledford, linux-rdma, Michael J. Ruhl, Ira Weiny, stable
On Thu, Feb 01, 2018 at 12:31:06PM -0800, Dennis Dalessandro wrote:
> From: Michael J. Ruhl <michael.j.ruhl@intel.com>
>
> The ev_file is an optional parameter for CQ creation. If the parameter
> is not passed, the ev_file pointer will be NULL. Using that pointer
> to set the cq_context will result in an OOPs.
>
> Verify that ev_file is not NULL before using.
>
> Cc: <stable@vger.kernel.org> # 4.14.x
> Fixes: 9ee79fce3642 ("IB/core: Add completion queue (cq) object actions")
> Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
> Reviewed-by: Ira Weiny <ira.weiny@intel.com>
> Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
> drivers/infiniband/core/uverbs_std_types.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
Yep! I was testing this recently and didn't hit this bug, it only
becomes a crash if something tries to use the cq..
Jason
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-01 22:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-01 20:31 [PATCH for-next] IB/core: Avoid a potential OOPs for an unused optional parameter Dennis Dalessandro
2018-02-01 22:52 ` Jason Gunthorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).