]> err.no Git - linux-2.6/commitdiff
[PATCH] Allow raw_notifier callouts to unregister themselves
authorAlan Stern <stern@rowland.harvard.edu>
Sun, 25 Jun 2006 12:47:15 +0000 (05:47 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sun, 25 Jun 2006 17:01:01 +0000 (10:01 -0700)
Since raw_notifier chains don't benefit from any centralized locking
protections, they shouldn't suffer from the associated limitations.  Under
some circumstances it might make sense for a raw_notifier callout routine
to unregister itself from the notifier chain.  This patch (as678) changes
the notifier core to allow for such things.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
kernel/sys.c

index 90930b28d2ca1ae77f643aaf44242d3f018f2e2f..7e0927bad713a8f422971a5d6e1d99149787fe8c 100644 (file)
@@ -137,14 +137,15 @@ static int __kprobes notifier_call_chain(struct notifier_block **nl,
                unsigned long val, void *v)
 {
        int ret = NOTIFY_DONE;
-       struct notifier_block *nb;
+       struct notifier_block *nb, *next_nb;
 
        nb = rcu_dereference(*nl);
        while (nb) {
+               next_nb = rcu_dereference(nb->next);
                ret = nb->notifier_call(nb, val, v);
                if ((ret & NOTIFY_STOP_MASK) == NOTIFY_STOP_MASK)
                        break;
-               nb = rcu_dereference(nb->next);
+               nb = next_nb;
        }
        return ret;
 }