diff mbox

[v2,5/5] intel_scu_ipc: protect dev member assignment on ->remove()

Message ID 1444648788-74265-6-git-send-email-andriy.shevchenko@linux.intel.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Andy Shevchenko Oct. 12, 2015, 11:19 a.m. UTC
Protect the dev member assignment in ->remove() since user may potentially call
unbind from a sysfs even if the driver is built-in. The latter might be racy
with ongoing SCU communication.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/platform/x86/intel_scu_ipc.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox

Patch

diff --git a/drivers/platform/x86/intel_scu_ipc.c b/drivers/platform/x86/intel_scu_ipc.c
index 9de2029..f94b730 100644
--- a/drivers/platform/x86/intel_scu_ipc.c
+++ b/drivers/platform/x86/intel_scu_ipc.c
@@ -625,7 +625,10 @@  static void ipc_remove(struct pci_dev *pdev)
 {
 	struct intel_scu_ipc_dev *scu = pci_get_drvdata(pdev);
 
+	mutex_lock(&ipclock);
 	scu->dev = NULL;
+	mutex_unlock(&ipclock);
+
 	iounmap(scu->i2c_base);
 	intel_scu_devices_destroy();
 }