summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2012-02-29 13:29:23 +0400
committerJiri Kosina <jkosina@suse.cz>2012-03-05 17:06:59 +0400
commit4e70daaf05a181b6968e29e72e9f1c16a183e92c (patch)
tree34001ce04cbc2476eab137483cdb42e084ac44cf
parentc3363c912ba743e6f981ba58c744e413fc41f943 (diff)
downloadlinux-4e70daaf05a181b6968e29e72e9f1c16a183e92c.tar.xz
tpm_tis: fix tis_lock with respect to RCU
cleanup_tis() -> tpm_remove_hardware() -> syncrhonize_rcu() is being called in an atomic context (tis_lock spinlock held), which is not allowed. Convert tis_lock to mutex. Signed-off-by: Jiri Kosina <jkosina@suse.cz> Tested-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Acked-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
-rw-r--r--drivers/char/tpm/tpm_tis.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index a1748621111b..70fac9abb0e2 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -76,7 +76,7 @@ enum tis_defaults {
#define TPM_RID(l) (0x0F04 | ((l) << 12))
static LIST_HEAD(tis_chips);
-static DEFINE_SPINLOCK(tis_lock);
+static DEFINE_MUTEX(tis_lock);
#if defined(CONFIG_PNP) && defined(CONFIG_ACPI)
static int is_itpm(struct pnp_dev *dev)
@@ -689,9 +689,9 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
}
INIT_LIST_HEAD(&chip->vendor.list);
- spin_lock(&tis_lock);
+ mutex_lock(&tis_lock);
list_add(&chip->vendor.list, &tis_chips);
- spin_unlock(&tis_lock);
+ mutex_unlock(&tis_lock);
return 0;
@@ -855,7 +855,7 @@ static void __exit cleanup_tis(void)
{
struct tpm_vendor_specific *i, *j;
struct tpm_chip *chip;
- spin_lock(&tis_lock);
+ mutex_lock(&tis_lock);
list_for_each_entry_safe(i, j, &tis_chips, list) {
chip = to_tpm_chip(i);
tpm_remove_hardware(chip->dev);
@@ -871,7 +871,7 @@ static void __exit cleanup_tis(void)
iounmap(i->iobase);
list_del(&i->list);
}
- spin_unlock(&tis_lock);
+ mutex_unlock(&tis_lock);
#ifdef CONFIG_PNP
if (!force) {
pnp_unregister_driver(&tis_pnp_driver);