summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordamien <damien@openbsd.org>2005-04-19 08:21:46 +0000
committerdamien <damien@openbsd.org>2005-04-19 08:21:46 +0000
commit0780f1a9f6b02457e8ab287bb2531c6de833293d (patch)
tree235d4419797b26c2b762d0517e382c7095219fc4
parentbackout. not discussed, and very wrong. bad brad (diff)
downloadwireguard-openbsd-0780f1a9f6b02457e8ab287bb2531c6de833293d.tar.xz
wireguard-openbsd-0780f1a9f6b02457e8ab287bb2531c6de833293d.zip
be more cautious when processing CMV interrupts.
drop every CMV reply that is not a CR or CW ack.
-rw-r--r--sys/dev/usb/ueagle.c19
-rw-r--r--sys/dev/usb/ueaglereg.h3
2 files changed, 12 insertions, 10 deletions
diff --git a/sys/dev/usb/ueagle.c b/sys/dev/usb/ueagle.c
index da4dcb9d8dd..0d9218961fb 100644
--- a/sys/dev/usb/ueagle.c
+++ b/sys/dev/usb/ueagle.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ueagle.c,v 1.1 2005/04/16 14:55:10 damien Exp $ */
+/* $OpenBSD: ueagle.c,v 1.2 2005/04/19 08:21:46 damien Exp $ */
/*-
* Copyright (c) 2003-2005
@@ -665,17 +665,18 @@ ueagle_cmv_intr(struct ueagle_softc *sc, struct ueagle_cmv *cmv)
/* synchronize our current CMV index with the modem */
sc->index = UGETW(cmv->wIndex) + 1;
- /* handle spontaneous CMVs */
- if (cmv->bFunction == UEAGLE_MODEMREADY) {
+ switch (cmv->bFunction) {
+ case UEAGLE_MODEMREADY:
wakeup(UEAGLE_COND_READY(sc));
- return;
- }
+ break;
- /* if it is the ack of a previous CR, save the data field */
- if (cmv->bFunction == UEAGLE_CR_ACK)
+ case UEAGLE_CR_ACK:
sc->data = UGETDATA(cmv->dwData);
-
- wakeup(UEAGLE_COND_CMV(sc));
+ /* FALLTHROUGH */
+ case UEAGLE_CW_ACK:
+ wakeup(UEAGLE_COND_CMV(sc));
+ break;
+ }
}
Static void
diff --git a/sys/dev/usb/ueaglereg.h b/sys/dev/usb/ueaglereg.h
index f6e2ed8b843..50da45ce610 100644
--- a/sys/dev/usb/ueaglereg.h
+++ b/sys/dev/usb/ueaglereg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ueaglereg.h,v 1.1 2005/04/16 14:55:10 damien Exp $ */
+/* $OpenBSD: ueaglereg.h,v 1.2 2005/04/19 08:21:47 damien Exp $ */
/*-
* Copyright (c) 2003-2005
@@ -82,6 +82,7 @@ struct ueagle_cmv {
#define UEAGLE_CR 0x10
#define UEAGLE_CW 0x11
#define UEAGLE_CR_ACK 0x12
+#define UEAGLE_CW_ACK 0x13
#define UEAGLE_MODEMREADY 0x71
uWord wIndex;