if_detach() should wait until concurrent (*if_qstart)() interface start
authormvs <mvs@openbsd.org>
Sun, 10 Jul 2022 21:26:55 +0000 (21:26 +0000)
committermvs <mvs@openbsd.org>
Sun, 10 Jul 2022 21:26:55 +0000 (21:26 +0000)
commitc853831c35ddbad16eb81c070679e8c3b085fe3a
tree7debbcfb6eaddd8a5f5578aacb717622dfdc3ace
parent77574026dba4970f125a32f7493e09fdc191efac
if_detach() should wait until concurrent (*if_qstart)() interface start
routines finished.

Call ifq_barrier(9) just after we unlinked dying interface from the stack.
From this point it is not accessible by if_get(9) and if_unit(9), and all
concurrent threads owning interface pointer finished. It also detached
from pseudo drivers like bridge(4). We only could have concurrent
(*if_qstart)() handlers running, so wait them and then continue
destruction.

Reported and tested by Hrvoje Popovski.

ok bluhm@
sys/net/if.c