IB/ucma: check workqueue allocation before usage
PATCH 1/1 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.
--- drivers/infiniband/core/ucma.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/infiniband/core/ucma.c +6 -1
@@ -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;
Signature · 6 lines
1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
What kernel is this patch against?
Quoted 31 lines
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 <[email protected]>--- drivers/infiniband/core/ucma.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/infiniband/core/ucma.c +6
-1@@ -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;
Quoted 3 lines
file->filp= filp;
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 1 line · Sean
What kernel is this patch against?
Patch is against linux-next.
Thanks,
Sasha
Quoted 30 lines
Quoted 30 lines
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 <[email protected]>--- drivers/infiniband/core/ucma.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/infiniband/core/ucma.c +6
-1@@ -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" );
Quoted 5 lines
Quoted 4 lines
drivers/infiniband/core/ucma.c +0
-0filp->private_data = file;
file->filp= filp;
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 2 lines · Sasha Levin
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.
Indeed.
Yishai, please check this and check the other patches you've sent to see if they have a similar error.
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 8 lines · Jason Gunthorpe
Quoted 2 lines · Sasha Levin
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.
Indeed.
Yishai, please check this and check the other patches you've sent to see if they have a similar error.
Ping? It doesn't seem that the patch got anywhere.
Thanks,
Sasha
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 11 lines · Sasha Levin
Quoted 8 lines · Jason Gunthorpe
Quoted 2 lines · Sasha Levin
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.
Indeed.
Yishai, please check this and check the other patches you've sent to see if they have a similar error.
Ping? It doesn't seem that the patch got anywhere.
Sorry, I took the "it applies to linux-next" to mean it wasn't against my tree yet and was against upcoming patches. That wasn't the case. It's been applied.
Signature · 2 lines
Doug Ledford <[email protected]> GPG KeyID: 0E572FDD