From owner-svn-src-head@FreeBSD.ORG Fri Oct 21 22:28:16 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 59C7A106564A; Fri, 21 Oct 2011 22:28:16 +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 48FA68FC1B; Fri, 21 Oct 2011 22:28:16 +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 p9LMSGrf044258; Fri, 21 Oct 2011 22:28:16 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9LMSGhn044256; Fri, 21 Oct 2011 22:28:16 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201110212228.p9LMSGhn044256@svn.freebsd.org> From: Gleb Smirnoff Date: Fri, 21 Oct 2011 22:28:16 +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: r226623 - 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: Fri, 21 Oct 2011 22:28:16 -0000 Author: glebius Date: Fri Oct 21 22:28:15 2011 New Revision: 226623 URL: http://svn.freebsd.org/changeset/base/226623 Log: Fix a race: we should update sc_len before dropping the pf lock, otherwise a number of packets can be queued on sc, while we are in ip_output(), and then we wipe the accumulated sc_len. On next pfsync_sendout() that would lead to writing beyond our mbuf cluster. 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 Fri Oct 21 22:12:24 2011 (r226622) +++ head/sys/contrib/pf/net/if_pfsync.c Fri Oct 21 22:28:15 2011 (r226623) @@ -2354,6 +2354,7 @@ pfsync_sendout(void) sc->sc_if.if_obytes += m->m_pkthdr.len; #endif + sc->sc_len = PFSYNC_MINPKT; #ifdef __FreeBSD__ PF_UNLOCK(); #endif @@ -2375,9 +2376,6 @@ pfsync_sendout(void) #ifdef __FreeBSD__ } #endif - - /* start again */ - sc->sc_len = PFSYNC_MINPKT; } void