* [PATCH] IB/ucma: check workqueue allocation before usage
@ 2015-09-17 20:04 Sasha Levin
[not found] ` <1442520259-2248-1-git-send-email-sasha.levin-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Sasha Levin @ 2015-09-17 20:04 UTC (permalink / raw)
To: dledford-H+wXaHxf7aLQT0dZR+AlfA,
sean.hefty-ral2JQCrhuEAvxtiuMwx3w,
hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, 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.
Signed-off-by: Sasha Levin <sasha.levin-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
---
drivers/infiniband/core/ucma.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c
index a53fc9b..30467d1 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;
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 6+ messages in thread[parent not found: <1442520259-2248-1-git-send-email-sasha.levin-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>]
* RE: [PATCH] IB/ucma: check workqueue allocation before usage [not found] ` <1442520259-2248-1-git-send-email-sasha.levin-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> @ 2015-09-17 20:10 ` Hefty, Sean [not found] ` <1828884A29C6694DAF28B7E6B8A82373A903C056-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org> 2015-09-17 22:59 ` Jason Gunthorpe 1 sibling, 1 reply; 6+ messages in thread From: Hefty, Sean @ 2015-09-17 20:10 UTC (permalink / raw) To: Sasha Levin, dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org What kernel is this patch against? > 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-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> > --- > drivers/infiniband/core/ucma.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/infiniband/core/ucma.c > b/drivers/infiniband/core/ucma.c > index a53fc9b..30467d1 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; > -- > 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <1828884A29C6694DAF28B7E6B8A82373A903C056-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>]
* Re: [PATCH] IB/ucma: check workqueue allocation before usage [not found] ` <1828884A29C6694DAF28B7E6B8A82373A903C056-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org> @ 2015-09-17 20:14 ` Sasha Levin 0 siblings, 0 replies; 6+ messages in thread From: Sasha Levin @ 2015-09-17 20:14 UTC (permalink / raw) To: Hefty, Sean, dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On 09/17/2015 04:10 PM, Hefty, Sean wrote: > What kernel is this patch against? Patch is against linux-next. Thanks, Sasha >> 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-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> >> --- >> drivers/infiniband/core/ucma.c | 7 ++++++- >> 1 file changed, 6 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/infiniband/core/ucma.c >> b/drivers/infiniband/core/ucma.c >> index a53fc9b..30467d1 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; >> -- >> 1.7.10.4 > -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] IB/ucma: check workqueue allocation before usage [not found] ` <1442520259-2248-1-git-send-email-sasha.levin-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> 2015-09-17 20:10 ` Hefty, Sean @ 2015-09-17 22:59 ` Jason Gunthorpe [not found] ` <20150917225934.GA22326-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org> 1 sibling, 1 reply; 6+ messages in thread From: Jason Gunthorpe @ 2015-09-17 22:59 UTC (permalink / raw) To: Yishai Hadas Cc: Sasha Levin, dledford-H+wXaHxf7aLQT0dZR+AlfA, sean.hefty-ral2JQCrhuEAvxtiuMwx3w, hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w, linux-rdma-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Thu, Sep 17, 2015 at 04:04:19PM -0400, Sasha Levin wrote: > 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <20150917225934.GA22326-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>]
* Re: [PATCH] IB/ucma: check workqueue allocation before usage [not found] ` <20150917225934.GA22326-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org> @ 2015-10-01 14:54 ` Sasha Levin [not found] ` <560D491F.7020200-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Sasha Levin @ 2015-10-01 14:54 UTC (permalink / raw) To: Jason Gunthorpe, Yishai Hadas Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA, sean.hefty-ral2JQCrhuEAvxtiuMwx3w, hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w, linux-rdma-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA On 09/17/2015 06:59 PM, Jason Gunthorpe wrote: > On Thu, Sep 17, 2015 at 04:04:19PM -0400, Sasha Levin wrote: >> 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <560D491F.7020200-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH] IB/ucma: check workqueue allocation before usage [not found] ` <560D491F.7020200-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> @ 2015-10-20 17:38 ` Doug Ledford 0 siblings, 0 replies; 6+ messages in thread From: Doug Ledford @ 2015-10-20 17:38 UTC (permalink / raw) To: Sasha Levin, Jason Gunthorpe, Yishai Hadas Cc: sean.hefty-ral2JQCrhuEAvxtiuMwx3w, hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w, linux-rdma-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 768 bytes --] On 10/01/2015 10:54 AM, Sasha Levin wrote: > On 09/17/2015 06:59 PM, Jason Gunthorpe wrote: >> On Thu, Sep 17, 2015 at 04:04:19PM -0400, Sasha Levin wrote: >>> 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. -- Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> GPG KeyID: 0E572FDD [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 884 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-10-20 17:38 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-17 20:04 [PATCH] IB/ucma: check workqueue allocation before usage Sasha Levin
[not found] ` <1442520259-2248-1-git-send-email-sasha.levin-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2015-09-17 20:10 ` Hefty, Sean
[not found] ` <1828884A29C6694DAF28B7E6B8A82373A903C056-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-09-17 20:14 ` Sasha Levin
2015-09-17 22:59 ` Jason Gunthorpe
[not found] ` <20150917225934.GA22326-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-10-01 14:54 ` Sasha Levin
[not found] ` <560D491F.7020200-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2015-10-20 17:38 ` Doug Ledford
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).