In ng_bypass() add more protection against potential race
with ng_rmnode() and its followers.
This commit is contained in:
parent
19afcd9829
commit
c3189b3fb4
@ -1161,6 +1161,10 @@ ng_bypass(hook_p hook1, hook_p hook2)
|
||||
return (EINVAL);
|
||||
}
|
||||
mtx_lock(&ng_topo_mtx);
|
||||
if (NG_HOOK_NOT_VALID(hook1) || NG_HOOK_NOT_VALID(hook2)) {
|
||||
mtx_unlock(&ng_topo_mtx);
|
||||
return (EINVAL);
|
||||
}
|
||||
hook1->hk_peer->hk_peer = hook2->hk_peer;
|
||||
hook2->hk_peer->hk_peer = hook1->hk_peer;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user