lkml.org 
[lkml]   [2005]   [Oct]   [26]   [last100]   RSS Feed
Views: [more markup]   [less markup]   [headers]   [forward]  
 
Messages in this thread
/
FromKeith Owens <>
SubjectRe: Notifier chains are unsafe
DateWed, 26 Oct 2005 16:11:46 +1000
On Mon, 24 Oct 2005 16:48:58 -0400 (EDT), 
Alan Stern <stern@rowland.harvard.edu> 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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-10-26 04:16    [W:0.862 / U:0.070 seconds]
©2003-2008 Jasper Spaans