Re: Notifier chains are unsafe
From: Keith Owens
Date: Wed Oct 26 2005 - 01:14:11 EST
On Mon, 24 Oct 2005 16:48:58 -0400 (EDT),
Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
>Has anyone been bothered by the fact that notifier chains are not safe
>with regard to registration and unregistration while the chain is in use?
>The notifier_chain_register and notifier_chain_unregister routines have
>writelock protections, but the corresponding readlock is never taken!
>
>It shouldn't be hard to make this work safely, even allowing such things
>as notifier routines unregistering themselves as they run. The patch
>below contains an example implementation, showing one way to do it.
>
>But doing this correctly requires knowing how notifier chains are used.
>
> Are they always called in process context, with interrupts enabled?
>
> Or do some get called in interrupt context?
Register and unregister should only be called from contexts that can
sleep, although that may not be documented. notifier_call_chain() can
be called in any context, it must not take any locks.
-
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/