aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/ucma.c
diff options
context:
space:
mode:
authorSasha Levin <sasha.levin@oracle.com>2015-09-17 16:04:19 -0400
committerDoug Ledford <dledford@redhat.com>2015-10-20 13:35:51 -0400
commit0174b381caf89443d92c6fe75f725f2bfeba96b6 (patch)
tree24f34472d9bad49d01a6563c8cf7b3a0db6f68f4 /drivers/infiniband/core/ucma.c
parentIB/cma: Potential NULL dereference in cma_id_from_event (diff)
downloadlinux-dev-0174b381caf89443d92c6fe75f725f2bfeba96b6.tar.xz
linux-dev-0174b381caf89443d92c6fe75f725f2bfeba96b6.zip
IB/ucma: check workqueue allocation before usage
Allocating a workqueue might fail, which wasn't checked so far and would lead to NULL ptr derefs when an attempt to use it was made. Signed-off-by: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/core/ucma.c')
-rw-r--r--drivers/infiniband/core/ucma.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c
index a53fc9b01c69..30467d10df91 100644
--- a/drivers/infiniband/core/ucma.c
+++ b/drivers/infiniband/core/ucma.c
@@ -1624,11 +1624,16 @@ static int ucma_open(struct inode *inode, struct file *filp)
if (!file)
return -ENOMEM;
+ file->close_wq = create_singlethread_workqueue("ucma_close_id");
+ if (!file->close_wq) {
+ kfree(file);
+ return -ENOMEM;
+ }
+
INIT_LIST_HEAD(&file->event_list);
INIT_LIST_HEAD(&file->ctx_list);
init_waitqueue_head(&file->poll_wait);
mutex_init(&file->mut);
- file->close_wq = create_singlethread_workqueue("ucma_close_id");
filp->private_data = file;
file->filp = filp;