Commit 307ab2a9 authored by Mario Limonciello's avatar Mario Limonciello Committed by Darren Hart (VMware)

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: default avatarMario Limonciello <mario.limonciello@dell.com>
Signed-off-by: default avatarDarren Hart (VMware) <dvhart@infradead.org>
parent 5e3e2297
...@@ -91,8 +91,10 @@ int dell_smbios_wmi_call(struct calling_interface_buffer *buffer) ...@@ -91,8 +91,10 @@ int dell_smbios_wmi_call(struct calling_interface_buffer *buffer)
mutex_lock(&call_mutex); mutex_lock(&call_mutex);
priv = get_first_smbios_priv(); priv = get_first_smbios_priv();
if (!priv) if (!priv) {
return -ENODEV; ret = -ENODEV;
goto out_wmi_call;
}
size = sizeof(struct calling_interface_buffer); size = sizeof(struct calling_interface_buffer);
difference = priv->req_buf_size - sizeof(u64) - size; difference = priv->req_buf_size - sizeof(u64) - size;
...@@ -101,6 +103,7 @@ int dell_smbios_wmi_call(struct calling_interface_buffer *buffer) ...@@ -101,6 +103,7 @@ int dell_smbios_wmi_call(struct calling_interface_buffer *buffer)
memcpy(&priv->buf->std, buffer, size); memcpy(&priv->buf->std, buffer, size);
ret = run_smbios_call(priv->wdev); ret = run_smbios_call(priv->wdev);
memcpy(buffer, &priv->buf->std, size); memcpy(buffer, &priv->buf->std, size);
out_wmi_call:
mutex_unlock(&call_mutex); mutex_unlock(&call_mutex);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment