summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2006-02-05 23:47:48 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2006-02-05 23:47:48 +0000
commit669e9351d44c2c6115953978f7d285f7895f1a68 (patch)
tree66cf2a03c79ca25d5f0ac1648cf5b5bdb5b61700
parent7794e1d75ad1eff0aad210723359cd4a0c251c10 (diff)
Add a fix from David Young to not set the ring indexes to something
obviously invalid, which can occur when ejecting a CardBus rtw.
-rw-r--r--sys/dev/ic/rtw.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/ic/rtw.c b/sys/dev/ic/rtw.c
index 232e4c80147..785187fd13e 100644
--- a/sys/dev/ic/rtw.c
+++ b/sys/dev/ic/rtw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtw.c,v 1.52 2006/01/05 05:40:35 jsg Exp $ */
+/* $OpenBSD: rtw.c,v 1.53 2006/02/05 23:47:47 jsg Exp $ */
/* $NetBSD: rtw.c,v 1.29 2004/12/27 19:49:16 dyoung Exp $ */
/*-
@@ -1692,7 +1692,7 @@ rtw_txring_fixup(struct rtw_softc *sc)
RTW_DPRINTF(RTW_DEBUG_BUGS,
("%s: tx-ring %d expected next %u, read %u\n", __func__,
pri, tdb->tdb_next, next));
- tdb->tdb_next = next;
+ tdb->tdb_next = MIN(next, tdb->tdb_ndesc - 1);
}
}
@@ -1711,7 +1711,7 @@ rtw_rxring_fixup(struct rtw_softc *sc)
RTW_DPRINTF(RTW_DEBUG_BUGS,
("%s: rx-ring expected next %u, read %u\n", __func__,
rdb->rdb_next, next));
- rdb->rdb_next = next;
+ rdb->rdb_next = MIN(next, rdb->rdb_ndesc - 1);
}
}