Date: Fri, 6 May 2016 19:14:57 +0000 (UTC) From: Sean Bruno <sbruno@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r299192 - in stable/10/sys/dev: e1000 ixgbe Message-ID: <201605061914.u46JEvZr076045@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605061914.u46JEvZr076045>