aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2012-03-05 18:15:54 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2012-03-05 18:15:54 +0000
commit81bca8e615d787428c691c568f2d9b07b0eb23d9 (patch)
tree7073ddfd452a4c5b8759c63eaa13fabfba185fd3
parent4f9a944ab4a26c68e0b5a267cdfcd7fce36aef9d (diff)
downloadsrc-81bca8e615d787428c691c568f2d9b07b0eb23d9.tar.gz
src-81bca8e615d787428c691c568f2d9b07b0eb23d9.zip
Merge r232556 from stable/8 (r231761 from head):
In ng_bypass() add more protection against potential race with ng_rmnode() and its followers. Approved by: re (kib)
Notes
Notes: svn path=/releng/8.3/; revision=232558
-rw-r--r--sys/netgraph/ng_base.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c
index 020b834d3876..c63d54df36ca 100644
--- a/sys/netgraph/ng_base.c
+++ b/sys/netgraph/ng_base.c
@@ -1169,6 +1169,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;