This is Christoph Lameter's original patch, posted to LKML some time ago,
but as yet unmerged.
Allow a notifier to remove itself from the notifier list.
If the next pointer is retrieved before notifier_call then the notifier can
remove itself from the chain.
Signed-off-by: Christoph Lameter <[email protected]>
Signed-off-by: Nigel Cunningham <[email protected]>
kernel/sys.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/kernel/sys.c b/kernel/sys.c
index d09cac2..46455fa 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -174,15 +174,18 @@ int __kprobes notifier_call_chain(struct
{
int ret=NOTIFY_DONE;
struct notifier_block *nb = *n;
+ struct notifier_block *next;
while(nb)
{
- ret=nb->notifier_call(nb,val,v);
+ /* Determining next here allows the notifier to unregister itself */
+ next = nb->next;
+ ret = nb->notifier_call(nb,val,v);
if(ret&NOTIFY_STOP_MASK)
{
return ret;
}
- nb=nb->next;
+ nb = next;
}
return ret;
}
--
Nigel Cunningham nigel at suspend2 dot net
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]