Correct possible underflow conditions when checking for available space
in the tx h/w ring buffer. Reviewed by: gnn jeb.j.cramer@intel.com MFC after: 1 week Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D5918
This commit is contained in:
parent
b1deed45e6
commit
ae6bd5b7be
@ -2092,7 +2092,7 @@ em_xmit(struct tx_ring *txr, struct mbuf **m_headp)
|
||||
txr->tx_tso = FALSE;
|
||||
}
|
||||
|
||||
if (nsegs > (txr->tx_avail - EM_MAX_SCATTER)) {
|
||||
if (txr->tx_avail < (nsegs + EM_MAX_SCATTER)) {
|
||||
txr->no_desc_avail++;
|
||||
bus_dmamap_unload(txr->txtag, map);
|
||||
return (ENOBUFS);
|
||||
|
@ -1887,7 +1887,7 @@ igb_xmit(struct tx_ring *txr, struct mbuf **m_headp)
|
||||
}
|
||||
|
||||
/* Make certain there are enough descriptors */
|
||||
if (nsegs > txr->tx_avail - 2) {
|
||||
if (txr->tx_avail < (nsegs + 2)) {
|
||||
txr->no_desc_avail++;
|
||||
bus_dmamap_unload(txr->txtag, map);
|
||||
return (ENOBUFS);
|
||||
|
@ -1699,7 +1699,7 @@ lem_xmit(struct adapter *adapter, struct mbuf **m_headp)
|
||||
return (error);
|
||||
}
|
||||
|
||||
if (nsegs > (adapter->num_tx_desc_avail - 2)) {
|
||||
if (adapter->num_tx_desc_avail < (nsegs + 2)) {
|
||||
adapter->no_tx_desc_avail2++;
|
||||
bus_dmamap_unload(adapter->txtag, map);
|
||||
return (ENOBUFS);
|
||||
|
@ -402,7 +402,7 @@ ixgbe_xmit(struct tx_ring *txr, struct mbuf **m_headp)
|
||||
}
|
||||
|
||||
/* Make certain there are enough descriptors */
|
||||
if (nsegs > txr->tx_avail - 2) {
|
||||
if (txr->tx_avail < (nsegs + 2)) {
|
||||
txr->no_desc_avail++;
|
||||
bus_dmamap_unload(txr->txtag, map);
|
||||
return (ENOBUFS);
|
||||
|
Loading…
Reference in New Issue
Block a user