Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1244599 > unrolled thread

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

Started byAndy Shevchenko <andriy.shevchenko@linux.intel.com>
First post2015-10-12 13:30 +0200
Last post2015-10-12 13:30 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 5/5] intel_scu_ipc: protect dev member assignment on ->remove() Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-10-12 13:30 +0200

#1244599 — [PATCH v2 5/5] intel_scu_ipc: protect dev member assignment on ->remove()

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2015-10-12 13:30 +0200
Subject[PATCH v2 5/5] intel_scu_ipc: protect dev member assignment on ->remove()
Message-ID<qiJsK-5Ti-7@gated-at.bofh.it>
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 --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();
 }
-- 
2.5.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web