Commit 7b9d1b22 authored by Heiko Carstens's avatar Heiko Carstens Committed by David S. Miller

iucv: prevent cpu hotplug when walking cpu_online_map.

The code used preempt_disable() to prevent cpu hotplug, however that
doesn't protect for cpus being added. So use get_online_cpus() instead.
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarUrsula Braun <braunu@de.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f1494ed1
...@@ -474,14 +474,14 @@ static void iucv_setmask_mp(void) ...@@ -474,14 +474,14 @@ static void iucv_setmask_mp(void)
{ {
int cpu; int cpu;
preempt_disable(); get_online_cpus();
for_each_online_cpu(cpu) for_each_online_cpu(cpu)
/* Enable all cpus with a declared buffer. */ /* Enable all cpus with a declared buffer. */
if (cpu_isset(cpu, iucv_buffer_cpumask) && if (cpu_isset(cpu, iucv_buffer_cpumask) &&
!cpu_isset(cpu, iucv_irq_cpumask)) !cpu_isset(cpu, iucv_irq_cpumask))
smp_call_function_single(cpu, iucv_allow_cpu, smp_call_function_single(cpu, iucv_allow_cpu,
NULL, 0, 1); NULL, 0, 1);
preempt_enable(); put_online_cpus();
} }
/** /**
...@@ -521,16 +521,17 @@ static int iucv_enable(void) ...@@ -521,16 +521,17 @@ static int iucv_enable(void)
goto out; goto out;
/* Declare per cpu buffers. */ /* Declare per cpu buffers. */
rc = -EIO; rc = -EIO;
preempt_disable(); get_online_cpus();
for_each_online_cpu(cpu) for_each_online_cpu(cpu)
smp_call_function_single(cpu, iucv_declare_cpu, NULL, 0, 1); smp_call_function_single(cpu, iucv_declare_cpu, NULL, 0, 1);
preempt_enable();
if (cpus_empty(iucv_buffer_cpumask)) if (cpus_empty(iucv_buffer_cpumask))
/* No cpu could declare an iucv buffer. */ /* No cpu could declare an iucv buffer. */
goto out_path; goto out_path;
put_online_cpus();
return 0; return 0;
out_path: out_path:
put_online_cpus();
kfree(iucv_path_table); kfree(iucv_path_table);
out: out:
return rc; return rc;
...@@ -545,7 +546,9 @@ static int iucv_enable(void) ...@@ -545,7 +546,9 @@ static int iucv_enable(void)
*/ */
static void iucv_disable(void) static void iucv_disable(void)
{ {
get_online_cpus();
on_each_cpu(iucv_retrieve_cpu, NULL, 0, 1); on_each_cpu(iucv_retrieve_cpu, NULL, 0, 1);
put_online_cpus();
kfree(iucv_path_table); kfree(iucv_path_table);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment