public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Correct some errors caught by buildbot
@ 2017-11-06  3:34 Mario Limonciello
  2017-11-06  3:34 ` [PATCH 1/2] platform/x86: wmi: release mutex on module acquistion failure Mario Limonciello
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Mario Limonciello @ 2017-11-06  3:34 UTC (permalink / raw)
  To: dvhart, Andy Shevchenko; +Cc: LKML, platform-driver-x86, Mario Limonciello

Some of the failure scenarios weren't releasing acquired mutexes.
Here are some patches that correct them.

Mario Limonciello (2):
  platform/x86: wmi: release mutex on module acquistion failure
  platform/x86: dell-smbios-wmi: release mutex lock on WMI call failure

 drivers/platform/x86/dell-smbios-wmi.c | 7 +++++--
 drivers/platform/x86/wmi.c             | 6 ++++--
 2 files changed, 9 insertions(+), 4 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] platform/x86: wmi: release mutex on module acquistion failure
  2017-11-06  3:34 [PATCH 0/2] Correct some errors caught by buildbot Mario Limonciello
@ 2017-11-06  3:34 ` Mario Limonciello
  2017-11-06  3:34 ` [PATCH 2/2] platform/x86: dell-smbios-wmi: release mutex lock on WMI call failure Mario Limonciello
  2017-11-08 20:56 ` [PATCH 0/2] Correct some errors caught by buildbot Darren Hart
  2 siblings, 0 replies; 4+ messages in thread
From: Mario Limonciello @ 2017-11-06  3:34 UTC (permalink / raw)
  To: dvhart, Andy Shevchenko; +Cc: LKML, platform-driver-x86, Mario Limonciello

This failure mode should have also released the mutex.

Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
---
 drivers/platform/x86/wmi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index 8c31ed4..791449a 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)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] platform/x86: dell-smbios-wmi: release mutex lock on WMI call failure
  2017-11-06  3:34 [PATCH 0/2] Correct some errors caught by buildbot Mario Limonciello
  2017-11-06  3:34 ` [PATCH 1/2] platform/x86: wmi: release mutex on module acquistion failure Mario Limonciello
@ 2017-11-06  3:34 ` Mario Limonciello
  2017-11-08 20:56 ` [PATCH 0/2] Correct some errors caught by buildbot Darren Hart
  2 siblings, 0 replies; 4+ messages in thread
From: Mario Limonciello @ 2017-11-06  3:34 UTC (permalink / raw)
  To: dvhart, Andy Shevchenko; +Cc: LKML, platform-driver-x86, Mario Limonciello

Unbound devices may race with calling this function causing the mutex
to stay locked.  This failure mode should have released the mutex too.

Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
---
 drivers/platform/x86/dell-smbios-wmi.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/dell-smbios-wmi.c b/drivers/platform/x86/dell-smbios-wmi.c
index 35c13815..5cf9b13 100644
--- a/drivers/platform/x86/dell-smbios-wmi.c
+++ b/drivers/platform/x86/dell-smbios-wmi.c
@@ -91,8 +91,10 @@ int dell_smbios_wmi_call(struct calling_interface_buffer *buffer)
 
 	mutex_lock(&call_mutex);
 	priv = get_first_smbios_priv();
-	if (!priv)
-		return -ENODEV;
+	if (!priv) {
+		ret = -ENODEV;
+		goto out_wmi_call;
+	}
 
 	size = sizeof(struct calling_interface_buffer);
 	difference = priv->req_buf_size - sizeof(u64) - size;
@@ -101,6 +103,7 @@ int dell_smbios_wmi_call(struct calling_interface_buffer *buffer)
 	memcpy(&priv->buf->std, buffer, size);
 	ret = run_smbios_call(priv->wdev);
 	memcpy(buffer, &priv->buf->std, size);
+out_wmi_call:
 	mutex_unlock(&call_mutex);
 
 	return ret;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] Correct some errors caught by buildbot
  2017-11-06  3:34 [PATCH 0/2] Correct some errors caught by buildbot Mario Limonciello
  2017-11-06  3:34 ` [PATCH 1/2] platform/x86: wmi: release mutex on module acquistion failure Mario Limonciello
  2017-11-06  3:34 ` [PATCH 2/2] platform/x86: dell-smbios-wmi: release mutex lock on WMI call failure Mario Limonciello
@ 2017-11-08 20:56 ` Darren Hart
  2 siblings, 0 replies; 4+ messages in thread
From: Darren Hart @ 2017-11-08 20:56 UTC (permalink / raw)
  To: Mario Limonciello; +Cc: Andy Shevchenko, LKML, platform-driver-x86

On Sun, Nov 05, 2017 at 09:34:32PM -0600, Mario Limonciello wrote:
> Some of the failure scenarios weren't releasing acquired mutexes.
> Here are some patches that correct them.

Queued, thanks Mario.


-- 
Darren Hart
VMware Open Source Technology Center

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-11-08 20:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-06  3:34 [PATCH 0/2] Correct some errors caught by buildbot Mario Limonciello
2017-11-06  3:34 ` [PATCH 1/2] platform/x86: wmi: release mutex on module acquistion failure Mario Limonciello
2017-11-06  3:34 ` [PATCH 2/2] platform/x86: dell-smbios-wmi: release mutex lock on WMI call failure Mario Limonciello
2017-11-08 20:56 ` [PATCH 0/2] Correct some errors caught by buildbot Darren Hart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox