From owner-svn-src-head@FreeBSD.ORG Sun Oct 23 15:08:18 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7B171065673; Sun, 23 Oct 2011 15:08:18 +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 AE4238FC14; Sun, 23 Oct 2011 15:08:18 +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 p9NF8I6I043492; Sun, 23 Oct 2011 15:08:18 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9NF8Ifk043490; Sun, 23 Oct 2011 15:08:18 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201110231508.p9NF8Ifk043490@svn.freebsd.org> From: Gleb Smirnoff Date: Sun, 23 Oct 2011 15:08:18 +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: r226661 - head/sys/contrib/pf/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Oct 2011 15:08:18 -0000 Author: glebius Date: Sun Oct 23 15:08:18 2011 New Revision: 226661 URL: http://svn.freebsd.org/changeset/base/226661 Log: - Fix a bad typo (FreeBSD specific) in pfsync_bulk_update(). Instead of scheduling next run pfsync_bulk_update(), pfsync_bulk_fail() was scheduled. This lead to instant 100% state leak after first bulk update request. - After above fix, it appeared that pfsync_bulk_update() lacks locking. To fix this, sc_bulk_tmo callout was converted to an mtx one. Eventually, all pf/pfsync callouts should be converted to mtx version, since it isn't possible to stop or drain a non-mtx callout without risk of race. - Add comment that callout_stop() in pfsync_clone_destroy() lacks locking. Since pfsync0 can't be destroyed (yet), let it be here. Modified: head/sys/contrib/pf/net/if_pfsync.c Modified: head/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- head/sys/contrib/pf/net/if_pfsync.c Sun Oct 23 14:59:54 2011 (r226660) +++ head/sys/contrib/pf/net/if_pfsync.c Sun Oct 23 15:08:18 2011 (r226661) @@ -493,7 +493,7 @@ pfsync_clone_create(struct if_clone *ifc ifp->if_mtu = 1500; /* XXX */ #ifdef __FreeBSD__ callout_init(&sc->sc_tmo, CALLOUT_MPSAFE); - callout_init(&sc->sc_bulk_tmo, CALLOUT_MPSAFE); + callout_init_mtx(&sc->sc_bulk_tmo, &pf_task_mtx, 0); callout_init(&sc->sc_bulkfail_tmo, CALLOUT_MPSAFE); #else ifp->if_hardmtu = MCLBYTES; /* XXX */ @@ -540,7 +540,7 @@ pfsync_clone_destroy(struct ifnet *ifp) #ifdef __FreeBSD__ EVENTHANDLER_DEREGISTER(ifnet_departure_event, sc->sc_detachtag); #endif - timeout_del(&sc->sc_bulk_tmo); + timeout_del(&sc->sc_bulk_tmo); /* XXX: need PF_LOCK() before */ timeout_del(&sc->sc_tmo); #if NCARP > 0 #ifdef notyet @@ -3061,7 +3061,7 @@ pfsync_bulk_update(void *arg) sc->sc_bulk_next = st; #ifdef __FreeBSD__ callout_reset(&sc->sc_bulk_tmo, 1, - pfsync_bulk_fail, sc); + pfsync_bulk_update, sc); #else timeout_add(&sc->sc_bulk_tmo, 1); #endif