Commit 1d2252fa authored by Kees Cook's avatar Kees Cook Committed by Linus Torvalds

kasan: unset panic_on_warn before calling panic()

As done in the full WARN() handler, panic_on_warn needs to be cleared
before calling panic() to avoid recursive panics.
Signed-off-by: default avatarKees Cook <>
Signed-off-by: default avatarAndrew Morton <>
Acked-by: default avatarDmitry Vyukov <>
Cc: Alexander Potapenko <>
Cc: Andrey Konovalov <>
Cc: Andrey Ryabinin <>
Cc: Ard Biesheuvel <>
Cc: Arnd Bergmann <>
Cc: Dan Carpenter <>
Cc: Elena Petrova <>
Cc: "Gustavo A. R. Silva" <>
Link: default avatarLinus Torvalds <>
parent 1d28c8d6
......@@ -92,8 +92,16 @@ static void end_report(unsigned long *flags)
spin_unlock_irqrestore(&report_lock, *flags);
if (panic_on_warn)
if (panic_on_warn) {
* This thread may hit another WARN() in the panic path.
* Resetting this prevents additional WARN() from panicking the
* system on this thread. Other threads are blocked by the
* panic_mutex in panic().
panic_on_warn = 0;
panic("panic_on_warn set ...\n");
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