aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/cxgb4
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2017-07-13 10:47:40 +0300
committerDoug Ledford <dledford@redhat.com>2017-07-20 11:20:49 -0400
commit6ebedacbb44602d4dec3348dee5ec31dd9b09521 (patch)
treeda8292c509436a3867c9a711869afc32957ad28a /drivers/infiniband/hw/cxgb4
parentIB/i40iw: Fix error code in i40iw_create_cq() (diff)
downloadlinux-dev-6ebedacbb44602d4dec3348dee5ec31dd9b09521.tar.xz
linux-dev-6ebedacbb44602d4dec3348dee5ec31dd9b09521.zip
cxgb4: Fix error codes in c4iw_create_cq()
If one of these kmalloc() calls fails then we return ERR_PTR(0) which is NULL. It results in a NULL dereference in the callers. Fixes: cfdda9d76436 ("RDMA/cxgb4: Add driver for Chelsio T4 RNIC") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/hw/cxgb4')
-rw-r--r--drivers/infiniband/hw/cxgb4/cq.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c
index e16fcaf6b5a3..be07da1997e6 100644
--- a/drivers/infiniband/hw/cxgb4/cq.c
+++ b/drivers/infiniband/hw/cxgb4/cq.c
@@ -963,6 +963,7 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev,
goto err3;
if (ucontext) {
+ ret = -ENOMEM;
mm = kmalloc(sizeof *mm, GFP_KERNEL);
if (!mm)
goto err4;