[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1352042642-7306-4-git-send-email-jiang.liu@huawei.com>
Date: Sun, 4 Nov 2012 23:23:56 +0800
From: Jiang Liu <liuj97@...il.com>
To: "Rafael J . Wysocki" <rjw@...k.pl>,
Yinghai Lu <yinghai@...nel.org>,
Tony Luck <tony.luck@...el.com>,
Yasuaki Ishimatsu <isimatu.yasuaki@...fujitsu.com>,
Wen Congyang <wency@...fujitsu.com>,
Tang Chen <tangchen@...fujitsu.com>,
Taku Izumi <izumi.taku@...fujitsu.com>,
Bjorn Helgaas <bhelgaas@...gle.com>
Cc: Jiang Liu <jiang.liu@...wei.com>,
Kenji Kaneshige <kaneshige.kenji@...fujitsu.com>,
Huang Ying <ying.huang@...el.com>,
Bob Moore <robert.moore@...el.com>,
Len Brown <lenb@...nel.org>,
"Srivatsa S . Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>,
Yijing Wang <wangyijing@...wei.com>,
Hanjun Guo <guohanjun@...wei.com>,
Jiang Liu <liuj97@...il.com>, linux-kernel@...r.kernel.org,
linux-acpi@...r.kernel.org, linux-pci@...r.kernel.org,
linux-mm@...ck.org
Subject: [ACPIHP PATCH part4 3/9] ACPIHP/processor: protect accesses to device->driver_data
CPU hotplug notification handler acpi_cpu_soft_notify() and driver
unbind method acpi_processor_remove() may be concurrently called.
acpi_cpu_soft_notify() will access device->driver_data, but that
data structure may be destroyed by acpi_processor_remove().
On the other hand, acpi_cpu_soft_notify() is always called under
protection of get_online_cpus(), so use get_online_cpus() to serialize
all accesses and modifications to device->driver_data.
Signed-off-by: Jiang Liu <jiang.liu@...wei.com>
---
drivers/acpi/processor_driver.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index 28add34..7d6d794 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -616,6 +616,8 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device)
return 0;
BUG_ON((pr->id >= nr_cpu_ids) || (pr->id < 0));
+ /* block CPU online/offline operations */
+ get_online_cpus();
result = acpi_processor_link(device, pr);
if (result)
goto err_unlock;
@@ -624,6 +626,7 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device)
if (result)
goto err_unlink;
}
+ put_online_cpus();
return 0;
@@ -654,8 +657,10 @@ static int acpi_processor_remove(struct acpi_device *device, int type)
return -EINVAL;
}
+ get_online_cpus();
acpi_processor_stop(device, pr);
acpi_processor_unlink(device, pr);
+ put_online_cpus();
free:
device->driver_data = NULL;
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists