diff options
| author | Mark Stapp <mjs@voltanet.io> | 2019-10-16 08:51:43 -0400 |
|---|---|---|
| committer | Mark Stapp <mjs@voltanet.io> | 2019-10-16 11:01:41 -0400 |
| commit | bd2b75a21e20bcf377d6bc2e30517d5c9072c287 (patch) | |
| tree | 0dbbab7370330134dc420a8294714dab19b4080c /nhrpd/nhrpd.h | |
| parent | e9f66ba9af7a2c37cacc3e2bab70237cf8dbab43 (diff) | |
nhrpd: be more careful with linked lists
NHRPD has its own linked-list implementation, and one of the
apis is a little free and easy with pointers. Also be safer
with one list iteration operation.
Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'nhrpd/nhrpd.h')
| -rw-r--r-- | nhrpd/nhrpd.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/nhrpd/nhrpd.h b/nhrpd/nhrpd.h index 50746d9ad5..ad38cad83b 100644 --- a/nhrpd/nhrpd.h +++ b/nhrpd/nhrpd.h @@ -76,8 +76,10 @@ static inline void notifier_del(struct notifier_block *n) static inline void notifier_call(struct notifier_list *l, int cmd) { struct notifier_block *n, *nn; - list_for_each_entry_safe(n, nn, &l->notifier_head, notifier_entry) - n->action(n, cmd); + list_for_each_entry_safe(n, nn, &l->notifier_head, notifier_entry) { + if (n) + n->action(n, cmd); + } } static inline int notifier_active(struct notifier_list *l) |
