summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2006-06-25 05:47:15 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-25 10:01:01 -0700
commitbbb1747d4e44ce49acc73daa8d66e5f6bd546f1b (patch)
tree28e9192804d3335e7585dd34bd4d5d9f236afc27
parentbfe5d834195b3089b8846577311340376cc0f450 (diff)
downloadop-kernel-dev-bbb1747d4e44ce49acc73daa8d66e5f6bd546f1b.zip
op-kernel-dev-bbb1747d4e44ce49acc73daa8d66e5f6bd546f1b.tar.gz
[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 <stern@rowland.harvard.edu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--kernel/sys.c5
1 files changed, 3 insertions, 2 deletions
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;
}
OpenPOWER on IntegriCloud