[PATCH] Allow raw_notifier callouts to unregister themselves

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>

---

Index: linux-2.6.17-rc3/kernel/sys.c
===================================================================
--- linux-2.6.17-rc3.orig/kernel/sys.c
+++ linux-2.6.17-rc3/kernel/sys.c
@@ -132,14 +132,15 @@ static int __kprobes notifier_call_chain
 		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;
 }

-
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]
  Powered by Linux