diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2016-12-26 16:58:19 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-26 20:30:24 -0500 |
commit | b9d9d6911bd5c370ad4b3aa57d758c093d17aed5 (patch) | |
tree | aa66dffa65f105ab98d5db3707c2262146d7fd8f | |
parent | b4b8664d291ac1998e0f0bcdc96b6397f0fe68b3 (diff) |
smp/hotplug: Undo tglxs brainfart
The attempt to prevent overwriting an active state resulted in a
disaster which effectively disables all dynamically allocated hotplug
states.
Cleanup the mess.
Fixes: dc280d936239 ("cpu/hotplug: Prevent overwriting of callbacks")
Reported-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Reported-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | kernel/cpu.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c index 042fd7e8e030..f75c4d031eeb 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
@@ -1471,6 +1471,7 @@ int __cpuhp_setup_state(enum cpuhp_state state, | |||
1471 | bool multi_instance) | 1471 | bool multi_instance) |
1472 | { | 1472 | { |
1473 | int cpu, ret = 0; | 1473 | int cpu, ret = 0; |
1474 | bool dynstate; | ||
1474 | 1475 | ||
1475 | if (cpuhp_cb_check(state) || !name) | 1476 | if (cpuhp_cb_check(state) || !name) |
1476 | return -EINVAL; | 1477 | return -EINVAL; |
@@ -1480,6 +1481,12 @@ int __cpuhp_setup_state(enum cpuhp_state state, | |||
1480 | ret = cpuhp_store_callbacks(state, name, startup, teardown, | 1481 | ret = cpuhp_store_callbacks(state, name, startup, teardown, |
1481 | multi_instance); | 1482 | multi_instance); |
1482 | 1483 | ||
1484 | dynstate = state == CPUHP_AP_ONLINE_DYN; | ||
1485 | if (ret > 0 && dynstate) { | ||
1486 | state = ret; | ||
1487 | ret = 0; | ||
1488 | } | ||
1489 | |||
1483 | if (ret || !invoke || !startup) | 1490 | if (ret || !invoke || !startup) |
1484 | goto out; | 1491 | goto out; |
1485 | 1492 | ||
@@ -1508,7 +1515,7 @@ out: | |||
1508 | * If the requested state is CPUHP_AP_ONLINE_DYN, return the | 1515 | * If the requested state is CPUHP_AP_ONLINE_DYN, return the |
1509 | * dynamically allocated state in case of success. | 1516 | * dynamically allocated state in case of success. |
1510 | */ | 1517 | */ |
1511 | if (!ret && state == CPUHP_AP_ONLINE_DYN) | 1518 | if (!ret && dynstate) |
1512 | return state; | 1519 | return state; |
1513 | return ret; | 1520 | return ret; |
1514 | } | 1521 | } |