From owner-svn-src-stable-11@freebsd.org Fri Nov 17 00:38:02 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10303DEF090; Fri, 17 Nov 2017 00:38:02 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CDF4372A65; Fri, 17 Nov 2017 00:38:01 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAH0c03G001216; Fri, 17 Nov 2017 00:38:00 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAH0c054001215; Fri, 17 Nov 2017 00:38:00 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201711170038.vAH0c054001215@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 17 Nov 2017 00:38:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325916 - stable/11/sys/dev/vnic X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/sys/dev/vnic X-SVN-Commit-Revision: 325916 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Nov 2017 00:38:02 -0000 Author: emaste Date: Fri Nov 17 00:38:00 2017 New Revision: 325916 URL: https://svnweb.freebsd.org/changeset/base/325916 Log: MFC r325683: vnic: apply BPF tap before passing packet to hardware Previously we passed tx packets to hardware via nicvf_tx_mbuf_locked and then to the BPF tap, with a possibly invalid mbuf which would result in a panic. PR: 223600 Discussed with: bz Sponsored by: The FreeBSD Foundation, Packet.net (hardware) Modified: stable/11/sys/dev/vnic/nicvf_queues.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/vnic/nicvf_queues.c ============================================================================== --- stable/11/sys/dev/vnic/nicvf_queues.c Thu Nov 16 23:36:19 2017 (r325915) +++ stable/11/sys/dev/vnic/nicvf_queues.c Fri Nov 17 00:38:00 2017 (r325916) @@ -992,6 +992,9 @@ nicvf_xmit_locked(struct snd_queue *sq) err = 0; while ((next = drbr_peek(ifp, sq->br)) != NULL) { + /* Send a copy of the frame to the BPF listener */ + ETHER_BPF_MTAP(ifp, next); + err = nicvf_tx_mbuf_locked(sq, &next); if (err != 0) { if (next == NULL) @@ -1002,8 +1005,6 @@ nicvf_xmit_locked(struct snd_queue *sq) break; } drbr_advance(ifp, sq->br); - /* Send a copy of the frame to the BPF listener */ - ETHER_BPF_MTAP(ifp, next); } return (err); }