1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys/net/grnc/netreg: avoid creating an infinite loop

This commit is contained in:
Benjamin Valentin 2023-02-02 17:44:24 +01:00 committed by Benjamin Valentin
parent 7d1ef9d99b
commit b7a5261508

View File

@ -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();