diff options
author | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2017-08-23 10:10:57 +0000 |
---|---|---|
committer | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2017-08-23 10:10:57 +0000 |
commit | 7842dcd4dfda3f70cf8ba45f85c9368d785194f7 (patch) | |
tree | bb9df95316a3019be50e9e9b030cf59377a36252 /sys/dev | |
parent | dc3e649050ba73a4e21bb560e70bfef675e9629f (diff) |
Prevent trashing of the producer index and descriptor counter
The last change has removed a clause that required caching producer
index and descriptor counter but introduced an early break that can
cause uninitialized values to be stored in the ring header.
Coverity CID 1453170, 1452971
OK visa
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/if_txp.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/sys/dev/pci/if_txp.c b/sys/dev/pci/if_txp.c index 9ea9b359832..718b4b8e08a 100644 --- a/sys/dev/pci/if_txp.c +++ b/sys/dev/pci/if_txp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_txp.c,v 1.126 2017/07/12 14:36:57 mikeb Exp $ */ +/* $OpenBSD: if_txp.c,v 1.127 2017/08/23 10:10:56 mikeb Exp $ */ /* * Copyright (c) 2001 @@ -1265,7 +1265,7 @@ txp_start(struct ifnet *ifp) struct txp_frag_desc *fxd; struct mbuf *m; struct txp_swdesc *sd; - u_int32_t firstprod, firstcnt, prod, cnt, i; + u_int32_t prod, cnt, i; if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd)) return; @@ -1281,9 +1281,6 @@ txp_start(struct ifnet *ifp) if (m == NULL) break; - firstprod = prod; - firstcnt = cnt; - sd = sc->sc_txd + prod; sd->sd_mbuf = m; @@ -1401,8 +1398,8 @@ txp_start(struct ifnet *ifp) oactive: ifq_set_oactive(&ifp->if_snd); - r->r_prod = firstprod; - r->r_cnt = firstcnt; + r->r_prod = prod; + r->r_cnt = cnt; } /* |