Skip to content

Commit

Permalink
sys/net/grnc/netreg: avoid creating an infinite loop
Browse files Browse the repository at this point in the history
  • Loading branch information
benpicco committed Feb 2, 2023
1 parent 7d1ef9d commit b7a5261
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sys/net/gnrc/netreg/gnrc_netreg.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@ int gnrc_netreg_register(gnrc_nettype_t type, gnrc_netreg_entry_t *entry)
}

_gnrc_netreg_acquire_exclusive();

/* don't add the same entry twice */
gnrc_netreg_entry_t *e;
LL_FOREACH(netreg[type], e) {
assert(entry != e);
}

LL_PREPEND(netreg[type], entry);
_gnrc_netreg_release_exclusive();

Expand Down

0 comments on commit b7a5261

Please sign in to comment.