From d6a11f61bcdf3ac3893b4ab6f01d72c590cb8644 Mon Sep 17 00:00:00 2001 From: glebius Date: Wed, 15 Feb 2012 14:29:23 +0000 Subject: In ng_bypass() add more protection against potential race with ng_rmnode() and its followers. --- sys/netgraph/ng_base.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sys/netgraph/ng_base.c') 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; -- cgit v1.1