summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2008-04-03 16:39:54 +0000
committerjsing <jsing@openbsd.org>2008-04-03 16:39:54 +0000
commitf76d16393a00f80551baec024c1d24ea84d82a92 (patch)
tree45863d2231dd81154ff7ff998f4f455c3d784961
parentopenssh-5.0 (diff)
downloadwireguard-openbsd-f76d16393a00f80551baec024c1d24ea84d82a92.tar.xz
wireguard-openbsd-f76d16393a00f80551baec024c1d24ea84d82a92.zip
Ensure that we wrap around to the start of the TXD buffer when incrementing
the TXD pointer beyond the end. Fixes PR5786.
-rw-r--r--sys/dev/pci/if_lii.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/pci/if_lii.c b/sys/dev/pci/if_lii.c
index 9b4ae4fe046..df19def4fb0 100644
--- a/sys/dev/pci/if_lii.c
+++ b/sys/dev/pci/if_lii.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_lii.c,v 1.9 2008/03/30 14:17:48 jsing Exp $ */
+/* $OpenBSD: if_lii.c,v 1.10 2008/04/03 16:39:54 jsing Exp $ */
/*
* Copyright (c) 2007 The NetBSD Foundation.
@@ -728,7 +728,7 @@ atl2_tx_put(struct atl2_softc *sc, struct mbuf *m)
}
/* Round to a 32-bit boundary */
- sc->sc_txd_cur = (sc->sc_txd_cur + 3) & ~3;
+ sc->sc_txd_cur = ((sc->sc_txd_cur + 3) & ~3) % AT_TXD_BUFFER_SIZE;
if (sc->sc_txd_cur == sc->sc_txd_ack)
sc->sc_free_tx_slots = 0;
}