summaryrefslogtreecommitdiff
path: root/drivers/infiniband/hw/i40iw/i40iw_main.c
diff options
context:
space:
mode:
authorKangjie Lu <kjlu@umn.edu>2019-03-15 01:57:14 -0500
committerJason Gunthorpe <jgg@mellanox.com>2019-03-27 10:19:07 -0300
commite2a438bd7116889af36304903b92e56d0f347228 (patch)
tree3812c8dde555c3fc50189e742969c40fcdf671c4 /drivers/infiniband/hw/i40iw/i40iw_main.c
parent4ae27444100f54e6db3a046f086ba4e70e1ac22b (diff)
RDMA/i40iw: Handle workqueue allocation failure
alloc_ordered_workqueue may fail and return NULL. The fix captures the failure and handles it properly to avoid potential NULL pointer dereferences. Signed-off-by: Kangjie Lu <kjlu@umn.edu> Reviewed-by: Shiraz, Saleem <shiraz.saleem@intel.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/hw/i40iw/i40iw_main.c')
-rw-r--r--drivers/infiniband/hw/i40iw/i40iw_main.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/i40iw/i40iw_main.c b/drivers/infiniband/hw/i40iw/i40iw_main.c
index 68095f00d08f..10932baee279 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_main.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_main.c
@@ -1641,7 +1641,10 @@ static int i40iw_open(struct i40e_info *ldev, struct i40e_client *client)
iwdev = &hdl->device;
iwdev->hdl = hdl;
dev = &iwdev->sc_dev;
- i40iw_setup_cm_core(iwdev);
+ if (i40iw_setup_cm_core(iwdev)) {
+ kfree(iwdev->hdl);
+ return -ENOMEM;
+ }
dev->back_dev = (void *)iwdev;
iwdev->ldev = &hdl->ldev;