mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-15 10:57:47 +00:00
IB/i40iw: Fix error code in i40iw_create_cq()
We accidentally forgot to set the error code if ib_copy_from_udata() fails. It means we return ERR_PTR(0) which is NULL and results in a NULL dereference in the callers. Fixes: d37498417947 ("i40iw: add files for iwarp interface") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Shiraz Saleem <shiraz.saleem@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
5c8857b653
commit
6031e079aa
@ -1168,8 +1168,10 @@ static struct ib_cq *i40iw_create_cq(struct ib_device *ibdev,
|
||||
memset(&req, 0, sizeof(req));
|
||||
iwcq->user_mode = true;
|
||||
ucontext = to_ucontext(context);
|
||||
if (ib_copy_from_udata(&req, udata, sizeof(struct i40iw_create_cq_req)))
|
||||
if (ib_copy_from_udata(&req, udata, sizeof(struct i40iw_create_cq_req))) {
|
||||
err_code = -EFAULT;
|
||||
goto cq_free_resources;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&ucontext->cq_reg_mem_list_lock, flags);
|
||||
iwpbl = i40iw_get_pbl((unsigned long)req.user_cq_buffer,
|
||||
|
Loading…
x
Reference in New Issue
Block a user