diff options
author | Peter Valchev <pvalchev@cvs.openbsd.org> | 2004-12-26 05:58:26 +0000 |
---|---|---|
committer | Peter Valchev <pvalchev@cvs.openbsd.org> | 2004-12-26 05:58:26 +0000 |
commit | aeee8ecd0a6066313f384907f77e2393ac956ec6 (patch) | |
tree | fb94ef7956d40a6fee0cc4a694ba9d2933bbd198 /sys/dev/pci | |
parent | 565d43a522dab2fec6ef155bd308877b4f9916cd (diff) |
Bounce the mbuf to the BPF listener before committing it to the wire
in the TX case, fixes rare problems associated with accessing already
free'd memory if the encap routine bails out (panic in PROMISC mode).
ok deraadt
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/if_vge.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/sys/dev/pci/if_vge.c b/sys/dev/pci/if_vge.c index 9eaffa2c725..69ee6d831ea 100644 --- a/sys/dev/pci/if_vge.c +++ b/sys/dev/pci/if_vge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vge.c,v 1.3 2004/12/26 05:54:30 pvalchev Exp $ */ +/* $OpenBSD: if_vge.c,v 1.4 2004/12/26 05:58:25 pvalchev Exp $ */ /* $FreeBSD: if_vge.c,v 1.3 2004/09/11 22:13:25 wpaul Exp $ */ /* * Copyright (c) 2004 @@ -1445,10 +1445,18 @@ vge_start(struct ifnet *ifp) while (sc->vge_ldata.vge_tx_mbuf[idx] == NULL) { IF_DEQUEUE(&ifp->if_snd, m_head); - if (m_head == NULL) break; + /* + * If there's a BPF listener, bounce a copy of this frame + * to him. + */ +#if NBPFILTER > 0 + if (ifp->if_bpf) + bpf_mtap(ifp->if_bpf, m_head); +#endif + if (vge_encap(sc, m_head, idx)) { IF_PREPEND(&ifp->if_snd, m_head); ifp->if_flags |= IFF_OACTIVE; @@ -1460,15 +1468,6 @@ vge_start(struct ifnet *ifp) pidx = idx; VGE_TX_DESC_INC(idx); - - /* - * If there's a BPF listener, bounce a copy of this frame - * to him. - */ -#if NBPFILTER > 0 - if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m_head); -#endif } if (idx == sc->vge_ldata.vge_tx_prodidx) { |