From: Alan Stern Date: Sun, 25 Jun 2006 12:47:15 +0000 (-0700) Subject: [PATCH] Allow raw_notifier callouts to unregister themselves X-Git-Tag: v2.6.18-rc1~1031 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bbb1747d4e44ce49acc73daa8d66e5f6bd546f1b;p=platform%2Fkernel%2Flinux-3.10.git [PATCH] Allow raw_notifier callouts to unregister themselves 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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/sys.c b/kernel/sys.c index 90930b2..7e0927b 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -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; }