From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: platform-driver-x86@vger.kernel.org,
Darren Hart <dvhart@infradead.org>,
linux-kernel@vger.kernel.org
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v2 5/5] intel_scu_ipc: protect dev member assignment on ->remove()
Date: Mon, 12 Oct 2015 14:19:48 +0300 [thread overview]
Message-ID: <1444648788-74265-6-git-send-email-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <1444648788-74265-1-git-send-email-andriy.shevchenko@linux.intel.com>
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
next prev parent reply other threads:[~2015-10-12 11:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-12 11:19 [PATCH v2 0/5] intel_scu_ipc: bug fixes and amendments Andy Shevchenko
2015-10-12 11:19 ` [PATCH v2 1/5] intel_scu_ipc: fix error path by turning to devm_* / pcim_* Andy Shevchenko
2015-10-12 11:19 ` [PATCH v2 2/5] intel_scu_ipc: propagate pointer to struct intel_scu_ipc_dev Andy Shevchenko
2015-10-12 11:19 ` [PATCH v2 3/5] intel_scu_ipc: convert to use struct device * Andy Shevchenko
2015-10-12 11:19 ` [PATCH v2 4/5] intel_scu_ipc: switch to use module_pci_driver() macro Andy Shevchenko
2015-10-12 11:19 ` Andy Shevchenko [this message]
2015-10-15 4:44 ` [PATCH v2 0/5] intel_scu_ipc: bug fixes and amendments Darren Hart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1444648788-74265-6-git-send-email-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=dvhart@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.