diff options
author | glebius <glebius@FreeBSD.org> | 2012-02-15 14:29:23 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2012-02-15 14:29:23 +0000 |
commit | d6a11f61bcdf3ac3893b4ab6f01d72c590cb8644 (patch) | |
tree | fce06c2b382dafbb7e6669a4868fb08cb11a1638 /sys/netgraph/ng_base.c | |
parent | 8525010c061f3f66c1c25891a2cd633ff42c6f17 (diff) | |
download | FreeBSD-src-d6a11f61bcdf3ac3893b4ab6f01d72c590cb8644.zip FreeBSD-src-d6a11f61bcdf3ac3893b4ab6f01d72c590cb8644.tar.gz |
In ng_bypass() add more protection against potential race
with ng_rmnode() and its followers.
Diffstat (limited to 'sys/netgraph/ng_base.c')
-rw-r--r-- | sys/netgraph/ng_base.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c index 2721deb..deed226 100644 --- a/sys/netgraph/ng_base.c +++ b/sys/netgraph/ng_base.c @@ -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; |