]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/kexec: Fix memory corruption from unallocated slaves
authorMilton Miller <miltonm@bga.com>
Tue, 10 May 2011 19:28:33 +0000 (19:28 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 19 May 2011 04:30:43 +0000 (14:30 +1000)
commit65db430d4f7ec27a8f6af2c15527033a998a23fe
tree2f43b11f58c81aa6891dae39f91f674842bb7e7e
parent262cbcdf76a83dfee896d7ac58985261701d26c4
powerpc/kexec: Fix memory corruption from unallocated slaves

Commit 6213b537cfb3ba2cca531bf8332fb00f3e84e2bb (powerpc/kexec: Fix race
in kexec shutdown) moved the write to signal the cpu had exited the kernel
from before the transition to real mode in kexec_smp_wait to kexec_wait.

Unfornately it missed that kexec_wait is used both by cpus leaving the
kernel and by secondary slave cpus that were not allocated a paca for
what ever reason -- they could be beyond nr_cpus or not described in
the current device tree for whatever reason (for example, kexec-load
was not refreshed after a cpu hotplug operation).  Cpus coming through
that path they will write to paca[NR_CPUS] which is beyond the space
allocated for the paca data and overwrite memory not allocated to pacas
but very likely still real mode accessable).

Move the write back to kexec_smp_wait, which is used only by cpus that
found their paca, but after the transition to real mode.

Signed-off-by: Milton Miller <miltonm@bga.com>
Cc: <stable@kernel.org> # (6213b53 was backported to 2.6.32)
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/kernel/misc_64.S