summaryrefslogtreecommitdiff
path: root/drivers/platform
diff options
context:
space:
mode:
authorMario Limonciello <mario.limonciello@dell.com>2017-11-06 06:34:34 +0300
committerDarren Hart (VMware) <dvhart@infradead.org>2017-11-08 23:58:37 +0300
commit307ab2a99d190d3a7949258b8551b66887ce8cf4 (patch)
treebaf2d32567b87f17dfd17dd11e780cc73df90eb1 /drivers/platform
parent5e3e22971fb0b0d7d03286f1a619d0348748a243 (diff)
downloadlinux-307ab2a99d190d3a7949258b8551b66887ce8cf4.tar.xz
platform/x86: dell-smbios-wmi: release mutex lock on WMI call failure
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> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/dell-smbios-wmi.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/platform/x86/dell-smbios-wmi.c b/drivers/platform/x86/dell-smbios-wmi.c
index 35c13815b24c..5cf9b13ce6e6 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;