/*
* Subject to the GPL, version 2.
*/
#include "xmalloc.h"
struct panic_handler {
void *arg;
pid_t pid;
bool is_enabled;
void (*on_panic)(void *arg);
struct panic_handler *next;
};
static struct panic_handler *panic_handlers;
void panic_handler_add(void (*on_panic)(void *arg), void *arg)
{
struct panic_handler *handler = xmallocz(sizeof(*handler));
handler->arg = arg;
handler->pid = getpid();
handler->is_enabled = true;
handler->on_panic = on_panic;
handler->next = panic_handlers;
panic_handlers = handler;
};
void call_panic_handlers(void)
{
struct panic_handler *it;
pid_t pid = getpid();
for (it = panic_handlers; it; it = it->next) {
if (it->pid == pid && it->is_enabled) {
it->is_enabled = false;
it->on_panic(it->arg);
}
}
}
'/cgit.png' alt='cgit logo'/>
x86/irq: Make irq activate operations symmetric
The recent commit which prevents double activation of interrupts unearthed
interesting code in x86. The code (ab)uses irq_domain_activate_irq() to
reconfigure an already activated interrupt. That trips over the prevention
code now.
Fix it by deactivating the interrupt before activating the new configuration.
Fixes: 08d85f3ea99f1 "irqdomain: Avoid activating interrupts more than once"
Reported-and-tested-by: Mike Galbraith <efault@gmx.de>
Reported-and-tested-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1701311901580.3457@nanos