summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2013-06-03 21:08:22 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2013-06-03 21:08:22 +0000
commit543787b454022b7705a76bb8570ee9a8b48ecc82 (patch)
tree8b4a347f7b8b1dec3a339fc3d570662197e03172 /sys/dev
parent7b563cd1a00de66091b7a21263b200951bb90fbe (diff)
vmxnet3_load_mbuf() could replace the mbuf but did not return the new
one which caused the following Tx bpf call to panic. Instead of moving the bpf hook in front of the vmxnet3_load_mbuf() function, we return the updated mbuf because we want don't want to see packets that don't go on the wire/chipset. Analyzed and discussed with yasuoka@ uebayasi@ OK yasuoka@ uebayasi@
Diffstat (limited to 'sys/dev')
-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 d9fc9241423..56286c93b39 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.2 2013/06/03 15:05:29 reyk Exp $ */
+/* $OpenBSD: if_vmx.c,v 1.3 2013/06/03 21:08:21 reyk Exp $ */
/*
* Copyright (c) 2013 Tsubai Masanari
@@ -163,7 +163,7 @@ void vmxnet3_reset(struct ifnet *);
int vmxnet3_init(struct vmxnet3_softc *);
int vmxnet3_ioctl(struct ifnet *, u_long, caddr_t);
void vmxnet3_start(struct ifnet *);
-int vmxnet3_load_mbuf(struct vmxnet3_softc *, struct mbuf *);
+int vmxnet3_load_mbuf(struct vmxnet3_softc *, struct mbuf **);
void vmxnet3_watchdog(struct ifnet *);
void vmxnet3_media_status(struct ifnet *, struct ifmediareq *);
int vmxnet3_media_change(struct ifnet *);
@@ -1047,7 +1047,7 @@ vmxnet3_start(struct ifnet *ifp)
break;
}
IFQ_DEQUEUE(&ifp->if_snd, m);
- if (vmxnet3_load_mbuf(sc, m)) {
+ if (vmxnet3_load_mbuf(sc, &m) != 0) {
m_freem(m);
ifp->if_oerrors++;
break;
@@ -1072,12 +1072,12 @@ vmxnet3_start(struct ifnet *ifp)
}
int
-vmxnet3_load_mbuf(struct vmxnet3_softc *sc, struct mbuf *m)
+vmxnet3_load_mbuf(struct vmxnet3_softc *sc, struct mbuf **m0)
{
struct vmxnet3_txqueue *tq = &sc->sc_txq[0];
struct vmxnet3_txring *ring = &tq->cmd_ring;
struct vmxnet3_txdesc *txd, *sop;
- struct mbuf *n;
+ struct mbuf *m = *m0, *n = NULL;
struct ip *ip;
bus_dmamap_t map = ring->dmap[ring->head];
int hlen, csum_off, error, nsegs, gen, i;
@@ -1124,7 +1124,7 @@ vmxnet3_load_mbuf(struct vmxnet3_softc *sc, struct mbuf *m)
n->m_pkthdr.ether_vtag = m->m_pkthdr.ether_vtag;
n->m_pkthdr.csum_flags = m->m_pkthdr.csum_flags;
m_freem(m);
- m = n;
+ m = *m0 = n;
if (bus_dmamap_load_mbuf(sc->sc_dmat, map, m, BUS_DMA_NOWAIT))
goto copy_error;
}