summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2016-01-25 10:39:21 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2016-01-25 10:39:21 +0000
commitbc35c9c0a6dd58a74d4e2a1a2d86d1f62bbc49c2 (patch)
treed64a16da0f340e2c6d8bd3fd66cc3ab16233b34d /sys
parentb16598fcec4662c5c8ade2339946556313ab4451 (diff)
In vmxnet3_start(), do not send the mbuf to bpf after passing it to
the hardware. This could have resulted in a page fault when the mbuf has already been freed by the TX interrupt handler on another CPU. This has the slight drawback that bpf can be called before the packet is eventually dropped by vmxnet3_load_mbuf() - but I'm getting this simple and verified fix in before doing further optimizations on the start handler. As discussed with mikeb@ jsg@ dlg@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/if_vmx.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/dev/pci/if_vmx.c b/sys/dev/pci/if_vmx.c
index 2a3367c35c2..9fd77cc7a6b 100644
--- a/sys/dev/pci/if_vmx.c
+++ b/sys/dev/pci/if_vmx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vmx.c,v 1.41 2016/01/04 16:16:56 mikeb Exp $ */
+/* $OpenBSD: if_vmx.c,v 1.42 2016/01/25 10:39:20 reyk Exp $ */
/*
* Copyright (c) 2013 Tsubai Masanari
@@ -1065,17 +1065,17 @@ vmxnet3_start(struct ifnet *ifp)
if (m == NULL)
break;
+#if NBPFILTER > 0
+ if (ifp->if_bpf)
+ bpf_mtap_ether(ifp->if_bpf, m, BPF_DIRECTION_OUT);
+#endif
+
n = vmxnet3_load_mbuf(sc, ring, &m);
if (n == -1) {
ifp->if_oerrors++;
continue;
}
-#if NBPFILTER > 0
- if (ifp->if_bpf)
- bpf_mtap_ether(ifp->if_bpf, m, BPF_DIRECTION_OUT);
-#endif
-
ifp->if_opackets++;
used += n;
}