oce(4): Account and trace mbufs before handing to hw
Once tx mbufs have been handed to hardware, nothing serializes the tx path against completion and potential use-after-free of the outbound mbuf. Perform accounting and BPF tap before queueing to hardware to avoid this race. Submitted by: Steve Wirtz <steve_wirtz AT dell.com> Reviewed by: markj, rstone Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D25364
This commit is contained in:
parent
75dc9c41ab
commit
b75a772875
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=362439
@ -1225,6 +1225,11 @@ oce_tx(POCE_SOFTC sc, struct mbuf **mpp, int wq_index)
|
|||||||
*/
|
*/
|
||||||
oce_is_pkt_dest_bmc(sc, m, &os2bmc, &m_new);
|
oce_is_pkt_dest_bmc(sc, m, &os2bmc, &m_new);
|
||||||
|
|
||||||
|
if_inc_counter(sc->ifp, IFCOUNTER_OBYTES, m->m_pkthdr.len);
|
||||||
|
if (m->m_flags & M_MCAST)
|
||||||
|
if_inc_counter(sc->ifp, IFCOUNTER_OMCASTS, 1);
|
||||||
|
ETHER_BPF_MTAP(sc->ifp, m);
|
||||||
|
|
||||||
OCE_WRITE_REG32(sc, db, wq->db_offset, reg_value);
|
OCE_WRITE_REG32(sc, db, wq->db_offset, reg_value);
|
||||||
|
|
||||||
} else if (rc == EFBIG) {
|
} else if (rc == EFBIG) {
|
||||||
@ -1400,7 +1405,7 @@ oce_start(struct ifnet *ifp)
|
|||||||
if (!sc->link_status)
|
if (!sc->link_status)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
do {
|
while (true) {
|
||||||
IF_DEQUEUE(&sc->ifp->if_snd, m);
|
IF_DEQUEUE(&sc->ifp->if_snd, m);
|
||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
break;
|
break;
|
||||||
@ -1417,12 +1422,7 @@ oce_start(struct ifnet *ifp)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (m != NULL)
|
}
|
||||||
ETHER_BPF_MTAP(ifp, m);
|
|
||||||
|
|
||||||
} while (TRUE);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1500,10 +1500,6 @@ oce_multiq_transmit(struct ifnet *ifp, struct mbuf *m, struct oce_wq *wq)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
drbr_advance(ifp, br);
|
drbr_advance(ifp, br);
|
||||||
if_inc_counter(ifp, IFCOUNTER_OBYTES, next->m_pkthdr.len);
|
|
||||||
if (next->m_flags & M_MCAST)
|
|
||||||
if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1);
|
|
||||||
ETHER_BPF_MTAP(ifp, next);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user