Author: sbruno
Date: Fri May 6 19:14:57 2016
New Revision: 299192
URL: https://svnweb.freebsd.org/changeset/base/299192
Log:
MFC r298224
Correct possible underflow conditions when checking for available space
in the tx h/w ring buffer.
Sponsored by: Limelight Networks
Modified:
stable/10/sys/dev/e1000/if_em.c
stable/10/sys/dev/e1000/if_igb.c
stable/10/sys/dev/e1000/if_lem.c
stable/10/sys/dev/ixgbe/ix_txrx.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/dev/e1000/if_em.c
==============================================================================
--- stable/10/sys/dev/e1000/if_em.c Fri May 6 19:11:47 2016
(r299191)
+++ stable/10/sys/dev/e1000/if_em.c Fri May 6 19:14:57 2016
(r299192)
@@ -2099,7 +2099,7 @@ retry:
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);
Modified: stable/10/sys/dev/e1000/if_igb.c
==============================================================================
--- stable/10/sys/dev/e1000/if_igb.c Fri May 6 19:11:47 2016
(r299191)
+++ stable/10/sys/dev/e1000/if_igb.c Fri May 6 19:14:57 2016
(r299192)
@@ -1843,7 +1843,7 @@ retry:
}
/* 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);
Modified: stable/10/sys/dev/e1000/if_lem.c
==============================================================================
--- stable/10/sys/dev/e1000/if_lem.c Fri May 6 19:11:47 2016
(r299191)
+++ stable/10/sys/dev/e1000/if_lem.c Fri May 6 19:14:57 2016
(r299192)
@@ -1694,7 +1694,7 @@ lem_xmit(struct adapter *adapter, struct
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);
Modified: stable/10/sys/dev/ixgbe/ix_txrx.c
==============================================================================
--- stable/10/sys/dev/ixgbe/ix_txrx.c Fri May 6 19:11:47 2016
(r299191)
+++ stable/10/sys/dev/ixgbe/ix_txrx.c Fri May 6 19:14:57 2016
(r299192)
@@ -401,7 +401,7 @@ retry:
}
/* 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);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "[email protected]"