aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64')
-rw-r--r--arch/x86_64/kernel/traps.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c
index 2700b1375c1f..0ebb281aa178 100644
--- a/arch/x86_64/kernel/traps.c
+++ b/arch/x86_64/kernel/traps.c
@@ -385,6 +385,7 @@ void out_of_line_bug(void)
385 385
386static DEFINE_SPINLOCK(die_lock); 386static DEFINE_SPINLOCK(die_lock);
387static int die_owner = -1; 387static int die_owner = -1;
388static unsigned int die_nest_count;
388 389
389unsigned __kprobes long oops_begin(void) 390unsigned __kprobes long oops_begin(void)
390{ 391{
@@ -399,6 +400,7 @@ unsigned __kprobes long oops_begin(void)
399 else 400 else
400 spin_lock(&die_lock); 401 spin_lock(&die_lock);
401 } 402 }
403 die_nest_count++;
402 die_owner = cpu; 404 die_owner = cpu;
403 console_verbose(); 405 console_verbose();
404 bust_spinlocks(1); 406 bust_spinlocks(1);
@@ -409,7 +411,13 @@ void __kprobes oops_end(unsigned long flags)
409{ 411{
410 die_owner = -1; 412 die_owner = -1;
411 bust_spinlocks(0); 413 bust_spinlocks(0);
412 spin_unlock_irqrestore(&die_lock, flags); 414 die_nest_count--;
415 if (die_nest_count)
416 /* We still own the lock */
417 local_irq_restore(flags);
418 else
419 /* Nest count reaches zero, release the lock. */
420 spin_unlock_irqrestore(&die_lock, flags);
413 if (panic_on_oops) 421 if (panic_on_oops)
414 panic("Oops"); 422 panic("Oops");
415} 423}