From owner-svn-src-all@FreeBSD.ORG Wed Feb 15 14:29:23 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2D6E1065672; Wed, 15 Feb 2012 14:29:23 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AD3118FC0A; Wed, 15 Feb 2012 14:29:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1FETNaT066000; Wed, 15 Feb 2012 14:29:23 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1FETN9B065998; Wed, 15 Feb 2012 14:29:23 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201202151429.q1FETN9B065998@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 15 Feb 2012 14:29:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231761 - head/sys/netgraph X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 14:29:23 -0000 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;