Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Feb 2012 14:29:23 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r231761 - head/sys/netgraph
Message-ID:  <201202151429.q1FETN9B065998@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Wed Feb 15 14:29:23 2012
New Revision: 231761
URL: http://svn.freebsd.org/changeset/base/231761

Log:
  In ng_bypass() add more protection against potential race
  with ng_rmnode() and its followers.

Modified:
  head/sys/netgraph/ng_base.c

Modified: head/sys/netgraph/ng_base.c
==============================================================================
--- head/sys/netgraph/ng_base.c	Wed Feb 15 14:26:50 2012	(r231760)
+++ head/sys/netgraph/ng_base.c	Wed Feb 15 14:29:23 2012	(r231761)
@@ -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;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201202151429.q1FETN9B065998>