Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0174b381 authored by Sasha Levin's avatar Sasha Levin Committed by Doug Ledford
Browse files

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: default avatarSasha Levin <sasha.levin@oracle.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent b3b51f9f
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -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;