Re: [PATCH] fix altsysrq deadlock

From: Andrew Morton
Date: Tue Oct 26 2004 - 21:45:14 EST


Jason Baron <jbaron@xxxxxxxxxx> wrote:
>
>
> This patch fixes a deadlock in the handle_sysrq function.
> ...
>> - __sysrq_lock_table();
> + if(!__sysrq_trylock_table()) {
> + if(in_interrupt())
> + return;
> + else
> + __sysrq_lock_table();
> + }
> +

This is only a partial solution - __sysrq_trylock_table() is exported to
modules which do who know what with it and they don't know how to handle
locking failures - they'll just go ahead and do a spin_unlock() of an
unlocked lock and mayhem will ensue.

What we need to do is to move all those inlined functions out of sysrq.h,
into sysrq.c then withdraw all those exported-to-modules helper functions
then remove __sysrq_trylock_table() altogether and then use
spin_lock_irqsave() in the appropriate places.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/