Skip to content

Commit

Permalink
[PATCH] Allow raw_notifier callouts to unregister themselves
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alan Stern authored and Linus Torvalds committed Jun 25, 2006
1 parent bfe5d83 commit bbb1747
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions kernel/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit bbb1747

Please sign in to comment.