* [PATCH] platform/x86: wmi: Unlock on error in wmi_ioctl()
@ 2017-11-13 10:06 ` Dan Carpenter
0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2017-11-13 10:06 UTC (permalink / raw)
To: Darren Hart, Mario Limonciello
Cc: Andy Shevchenko, platform-driver-x86, kernel-janitors
We need to drop a lock if try_module_get() fails.
Fixes: 44b6b7661132 ("platform/x86: wmi: create userspace interface for drivers")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index 8c31ed4f0e1b..791449a2370f 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -868,8 +868,10 @@ static long wmi_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
/* let the driver do any filtering and do the call */
wdriver = container_of(wblock->dev.dev.driver,
struct wmi_driver, driver);
- if (!try_module_get(wdriver->driver.owner))
- return -EBUSY;
+ if (!try_module_get(wdriver->driver.owner)) {
+ ret = -EBUSY;
+ goto out_ioctl;
+ }
ret = wdriver->filter_callback(&wblock->dev, cmd, buf);
module_put(wdriver->driver.owner);
if (ret)
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] platform/x86: wmi: Unlock on error in wmi_ioctl()
@ 2017-11-13 10:06 ` Dan Carpenter
0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2017-11-13 10:06 UTC (permalink / raw)
To: Darren Hart, Mario Limonciello
Cc: Andy Shevchenko, platform-driver-x86, kernel-janitors
We need to drop a lock if try_module_get() fails.
Fixes: 44b6b7661132 ("platform/x86: wmi: create userspace interface for drivers")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index 8c31ed4f0e1b..791449a2370f 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -868,8 +868,10 @@ static long wmi_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
/* let the driver do any filtering and do the call */
wdriver = container_of(wblock->dev.dev.driver,
struct wmi_driver, driver);
- if (!try_module_get(wdriver->driver.owner))
- return -EBUSY;
+ if (!try_module_get(wdriver->driver.owner)) {
+ ret = -EBUSY;
+ goto out_ioctl;
+ }
ret = wdriver->filter_callback(&wblock->dev, cmd, buf);
module_put(wdriver->driver.owner);
if (ret)
^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: [PATCH] platform/x86: wmi: Unlock on error in wmi_ioctl()
2017-11-13 10:06 ` Dan Carpenter
(?)
@ 2017-11-13 14:51 ` Mario.Limonciello
2017-11-13 17:21 ` Darren Hart
-1 siblings, 1 reply; 5+ messages in thread
From: Mario.Limonciello @ 2017-11-13 14:51 UTC (permalink / raw)
To: dan.carpenter, dvhart; +Cc: andy, platform-driver-x86, kernel-janitors
> -----Original Message-----
> From: Dan Carpenter [mailto:dan.carpenter@oracle.com]
> Sent: Monday, November 13, 2017 4:06 AM
> To: Darren Hart <dvhart@infradead.org>; Limonciello, Mario
> <Mario_Limonciello@Dell.com>
> Cc: Andy Shevchenko <andy@infradead.org>; platform-driver-
> x86@vger.kernel.org; kernel-janitors@vger.kernel.org
> Subject: [PATCH] platform/x86: wmi: Unlock on error in wmi_ioctl()
>
> We need to drop a lock if try_module_get() fails.
>
> Fixes: 44b6b7661132 ("platform/x86: wmi: create userspace interface for drivers")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
> index 8c31ed4f0e1b..791449a2370f 100644
> --- a/drivers/platform/x86/wmi.c
> +++ b/drivers/platform/x86/wmi.c
> @@ -868,8 +868,10 @@ static long wmi_ioctl(struct file *filp, unsigned int cmd,
> unsigned long arg)
> /* let the driver do any filtering and do the call */
> wdriver = container_of(wblock->dev.dev.driver,
> struct wmi_driver, driver);
> - if (!try_module_get(wdriver->driver.owner))
> - return -EBUSY;
> + if (!try_module_get(wdriver->driver.owner)) {
> + ret = -EBUSY;
> + goto out_ioctl;
> + }
> ret = wdriver->filter_callback(&wblock->dev, cmd, buf);
> module_put(wdriver->driver.owner);
> if (ret)
Hi Dan,
Thanks for submitting. This exact same fix is in the subsystem "testing" branch
but hasn't yet been promoted to -next.
http://git.infradead.org/users/dvhart/linux-platform-drivers-x86.git/commit/5e3e22971fb0b0d7d03286f1a619d0348748a243
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] platform/x86: wmi: Unlock on error in wmi_ioctl()
2017-11-13 14:51 ` Mario.Limonciello
@ 2017-11-13 17:21 ` Darren Hart
0 siblings, 0 replies; 5+ messages in thread
From: Darren Hart @ 2017-11-13 17:21 UTC (permalink / raw)
To: Mario.Limonciello
Cc: dan.carpenter, andy, platform-driver-x86, kernel-janitors
On Mon, Nov 13, 2017 at 02:51:55PM +0000, Mario.Limonciello@dell.com wrote:
> > -----Original Message-----
> > From: Dan Carpenter [mailto:dan.carpenter@oracle.com]
> > Sent: Monday, November 13, 2017 4:06 AM
> > To: Darren Hart <dvhart@infradead.org>; Limonciello, Mario
> > <Mario_Limonciello@Dell.com>
> > Cc: Andy Shevchenko <andy@infradead.org>; platform-driver-
> > x86@vger.kernel.org; kernel-janitors@vger.kernel.org
> > Subject: [PATCH] platform/x86: wmi: Unlock on error in wmi_ioctl()
> >
> > We need to drop a lock if try_module_get() fails.
> >
> > Fixes: 44b6b7661132 ("platform/x86: wmi: create userspace interface for drivers")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> >
> > diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
> > index 8c31ed4f0e1b..791449a2370f 100644
> > --- a/drivers/platform/x86/wmi.c
> > +++ b/drivers/platform/x86/wmi.c
> > @@ -868,8 +868,10 @@ static long wmi_ioctl(struct file *filp, unsigned int cmd,
> > unsigned long arg)
> > /* let the driver do any filtering and do the call */
> > wdriver = container_of(wblock->dev.dev.driver,
> > struct wmi_driver, driver);
> > - if (!try_module_get(wdriver->driver.owner))
> > - return -EBUSY;
> > + if (!try_module_get(wdriver->driver.owner)) {
> > + ret = -EBUSY;
> > + goto out_ioctl;
> > + }
> > ret = wdriver->filter_callback(&wblock->dev, cmd, buf);
> > module_put(wdriver->driver.owner);
> > if (ret)
>
> Hi Dan,
>
> Thanks for submitting. This exact same fix is in the subsystem "testing" branch
> but hasn't yet been promoted to -next.
>
> http://git.infradead.org/users/dvhart/linux-platform-drivers-x86.git/commit/5e3e22971fb0b0d7d03286f1a619d0348748a243
And Mario's versions have now been pushed to for-next.
>
>
--
Darren Hart
VMware Open Source Technology Center
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] platform/x86: wmi: Unlock on error in wmi_ioctl()
@ 2017-11-13 17:21 ` Darren Hart
0 siblings, 0 replies; 5+ messages in thread
From: Darren Hart @ 2017-11-13 17:21 UTC (permalink / raw)
To: Mario.Limonciello
Cc: dan.carpenter, andy, platform-driver-x86, kernel-janitors
On Mon, Nov 13, 2017 at 02:51:55PM +0000, Mario.Limonciello@dell.com wrote:
> > -----Original Message-----
> > From: Dan Carpenter [mailto:dan.carpenter@oracle.com]
> > Sent: Monday, November 13, 2017 4:06 AM
> > To: Darren Hart <dvhart@infradead.org>; Limonciello, Mario
> > <Mario_Limonciello@Dell.com>
> > Cc: Andy Shevchenko <andy@infradead.org>; platform-driver-
> > x86@vger.kernel.org; kernel-janitors@vger.kernel.org
> > Subject: [PATCH] platform/x86: wmi: Unlock on error in wmi_ioctl()
> >
> > We need to drop a lock if try_module_get() fails.
> >
> > Fixes: 44b6b7661132 ("platform/x86: wmi: create userspace interface for drivers")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> >
> > diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
> > index 8c31ed4f0e1b..791449a2370f 100644
> > --- a/drivers/platform/x86/wmi.c
> > +++ b/drivers/platform/x86/wmi.c
> > @@ -868,8 +868,10 @@ static long wmi_ioctl(struct file *filp, unsigned int cmd,
> > unsigned long arg)
> > /* let the driver do any filtering and do the call */
> > wdriver = container_of(wblock->dev.dev.driver,
> > struct wmi_driver, driver);
> > - if (!try_module_get(wdriver->driver.owner))
> > - return -EBUSY;
> > + if (!try_module_get(wdriver->driver.owner)) {
> > + ret = -EBUSY;
> > + goto out_ioctl;
> > + }
> > ret = wdriver->filter_callback(&wblock->dev, cmd, buf);
> > module_put(wdriver->driver.owner);
> > if (ret)
>
> Hi Dan,
>
> Thanks for submitting. This exact same fix is in the subsystem "testing" branch
> but hasn't yet been promoted to -next.
>
> http://git.infradead.org/users/dvhart/linux-platform-drivers-x86.git/commit/5e3e22971fb0b0d7d03286f1a619d0348748a243
And Mario's versions have now been pushed to for-next.
>
>
--
Darren Hart
VMware Open Source Technology Center
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-11-13 17:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-13 10:06 [PATCH] platform/x86: wmi: Unlock on error in wmi_ioctl() Dan Carpenter
2017-11-13 10:06 ` Dan Carpenter
2017-11-13 14:51 ` Mario.Limonciello
2017-11-13 17:21 ` Darren Hart
2017-11-13 17:21 ` Darren Hart
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.