Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Nov 2017 22:17:30 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r325683 - head/sys/dev/vnic
Message-ID:  <201711102217.vAAMHUJB032152@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Fri Nov 10 22:17:30 2017
New Revision: 325683
URL: https://svnweb.freebsd.org/changeset/base/325683

Log:
  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
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation, Packet.net (hardware)

Modified:
  head/sys/dev/vnic/nicvf_queues.c

Modified: head/sys/dev/vnic/nicvf_queues.c
==============================================================================
--- head/sys/dev/vnic/nicvf_queues.c	Fri Nov 10 21:52:33 2017	(r325682)
+++ head/sys/dev/vnic/nicvf_queues.c	Fri Nov 10 22:17:30 2017	(r325683)
@@ -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);
 }



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