notifier.c (c203e45f069af47ca7623e4dcd8c00bfba2722e4) notifier.c (1b2439dbb703ae8d95a9ce7ece6b7800b80f41f0)
1#include <linux/kdebug.h>
2#include <linux/kprobes.h>
3#include <linux/module.h>
4#include <linux/notifier.h>
5#include <linux/rcupdate.h>
6#include <linux/vmalloc.h>
7#include <linux/reboot.h>
8

--- 7 unchanged lines hidden (view full) ---

16/*
17 * Notifier chain core routines. The exported routines below
18 * are layered on top of these, with appropriate locking added.
19 */
20
21static int notifier_chain_register(struct notifier_block **nl,
22 struct notifier_block *n)
23{
1#include <linux/kdebug.h>
2#include <linux/kprobes.h>
3#include <linux/module.h>
4#include <linux/notifier.h>
5#include <linux/rcupdate.h>
6#include <linux/vmalloc.h>
7#include <linux/reboot.h>
8

--- 7 unchanged lines hidden (view full) ---

16/*
17 * Notifier chain core routines. The exported routines below
18 * are layered on top of these, with appropriate locking added.
19 */
20
21static int notifier_chain_register(struct notifier_block **nl,
22 struct notifier_block *n)
23{
24 if (!kernel_text_address((unsigned long)n->notifier_call)) {
25 WARN(1, "Invalid notifier registered!");
26 return 0;
27 }
24 while ((*nl) != NULL) {
25 if (n->priority > (*nl)->priority)
26 break;
27 nl = &((*nl)->next);
28 }
29 n->next = *nl;
30 rcu_assign_pointer(*nl, n);
31 return 0;
32}
33
34static int notifier_chain_cond_register(struct notifier_block **nl,
35 struct notifier_block *n)
36{
28 while ((*nl) != NULL) {
29 if (n->priority > (*nl)->priority)
30 break;
31 nl = &((*nl)->next);
32 }
33 n->next = *nl;
34 rcu_assign_pointer(*nl, n);
35 return 0;
36}
37
38static int notifier_chain_cond_register(struct notifier_block **nl,
39 struct notifier_block *n)
40{
41 if (!kernel_text_address((unsigned long)n->notifier_call)) {
42 WARN(1, "Invalid notifier registered!");
43 return 0;
44 }
37 while ((*nl) != NULL) {
38 if ((*nl) == n)
39 return 0;
40 if (n->priority > (*nl)->priority)
41 break;
42 nl = &((*nl)->next);
43 }
44 n->next = *nl;

--- 32 unchanged lines hidden (view full) ---

77{
78 int ret = NOTIFY_DONE;
79 struct notifier_block *nb, *next_nb;
80
81 nb = rcu_dereference(*nl);
82
83 while (nb && nr_to_call) {
84 next_nb = rcu_dereference(nb->next);
45 while ((*nl) != NULL) {
46 if ((*nl) == n)
47 return 0;
48 if (n->priority > (*nl)->priority)
49 break;
50 nl = &((*nl)->next);
51 }
52 n->next = *nl;

--- 32 unchanged lines hidden (view full) ---

85{
86 int ret = NOTIFY_DONE;
87 struct notifier_block *nb, *next_nb;
88
89 nb = rcu_dereference(*nl);
90
91 while (nb && nr_to_call) {
92 next_nb = rcu_dereference(nb->next);
93
94#ifdef CONFIG_DEBUG_NOTIFIERS
95 if (!kernel_text_address((unsigned long)nb->notifier_call)) {
96 WARN(1, "Invalid notifier called!");
97 nb = next_nb;
98 continue;
99 }
100#endif
85 ret = nb->notifier_call(nb, val, v);
86
87 if (nr_calls)
88 (*nr_calls)++;
89
90 if ((ret & NOTIFY_STOP_MASK) == NOTIFY_STOP_MASK)
91 break;
92 nb = next_nb;

--- 486 unchanged lines hidden ---
101 ret = nb->notifier_call(nb, val, v);
102
103 if (nr_calls)
104 (*nr_calls)++;
105
106 if ((ret & NOTIFY_STOP_MASK) == NOTIFY_STOP_MASK)
107 break;
108 nb = next_nb;

--- 486 unchanged lines hidden ---