mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 08:19:28 +00:00
[PATCH] i386: don't blindly enable interrupts in die()
Rather than blindly re-enabling interrupts in die(), save their state upon entry and then restore that state. If the kernel is in really bad condition and faults with interrupts disabled, re-enabling them in die() may cause even more trouble, implying more chances of data corruption. Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
7c4cb60e5b
commit
e43d674f44
1 changed files with 5 additions and 2 deletions
|
@ -306,14 +306,17 @@ void die(const char * str, struct pt_regs * regs, long err)
|
||||||
.lock_owner_depth = 0
|
.lock_owner_depth = 0
|
||||||
};
|
};
|
||||||
static int die_counter;
|
static int die_counter;
|
||||||
|
unsigned long flags;
|
||||||
|
|
||||||
if (die.lock_owner != raw_smp_processor_id()) {
|
if (die.lock_owner != raw_smp_processor_id()) {
|
||||||
console_verbose();
|
console_verbose();
|
||||||
spin_lock_irq(&die.lock);
|
spin_lock_irqsave(&die.lock, flags);
|
||||||
die.lock_owner = smp_processor_id();
|
die.lock_owner = smp_processor_id();
|
||||||
die.lock_owner_depth = 0;
|
die.lock_owner_depth = 0;
|
||||||
bust_spinlocks(1);
|
bust_spinlocks(1);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
local_save_flags(flags);
|
||||||
|
|
||||||
if (++die.lock_owner_depth < 3) {
|
if (++die.lock_owner_depth < 3) {
|
||||||
int nl = 0;
|
int nl = 0;
|
||||||
|
@ -340,7 +343,7 @@ void die(const char * str, struct pt_regs * regs, long err)
|
||||||
|
|
||||||
bust_spinlocks(0);
|
bust_spinlocks(0);
|
||||||
die.lock_owner = -1;
|
die.lock_owner = -1;
|
||||||
spin_unlock_irq(&die.lock);
|
spin_unlock_irqrestore(&die.lock, flags);
|
||||||
|
|
||||||
if (kexec_should_crash(current))
|
if (kexec_should_crash(current))
|
||||||
crash_kexec(regs);
|
crash_kexec(regs);
|
||||||
|
|
Loading…
Reference in a new issue