summaryrefslogtreecommitdiffstats
path: root/sys/dev/ic/osiop.c
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2005-04-27 21:34:18 +0000
committermiod <miod@openbsd.org>2005-04-27 21:34:18 +0000
commitfa86ab978a99e73cc7226d45ee95a060f0a2fab5 (patch)
tree576f1ecd2af9691d2c4f7217417bcd48557e5f6d /sys/dev/ic/osiop.c
parentShave more stack operations, courtesy of the not-so-new-now ABI. (diff)
downloadwireguard-openbsd-fa86ab978a99e73cc7226d45ee95a060f0a2fab5.tar.xz
wireguard-openbsd-fa86ab978a99e73cc7226d45ee95a060f0a2fab5.zip
In osiop_checkintr(), bail out early and do not claim the interrupt for
``can't happen'' situations (which happen sometimes on mvme88k), rather than inadvertently dereference NULL pointers and panic.
Diffstat (limited to 'sys/dev/ic/osiop.c')
-rw-r--r--sys/dev/ic/osiop.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/sys/dev/ic/osiop.c b/sys/dev/ic/osiop.c
index e54b4a5af07..2eb18f4d003 100644
--- a/sys/dev/ic/osiop.c
+++ b/sys/dev/ic/osiop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: osiop.c,v 1.23 2004/12/27 15:53:13 miod Exp $ */
+/* $OpenBSD: osiop.c,v 1.24 2005/04/27 21:34:18 miod Exp $ */
/* $NetBSD: osiop.c,v 1.9 2002/04/05 18:27:54 bouyer Exp $ */
/*
@@ -1159,9 +1159,11 @@ osiop_checkintr(sc, istat, dstat, sstat0, status)
if (dstat & OSIOP_DSTAT_SIR && intcode == A_ok) {
/* Normal completion status, or check condition */
struct osiop_tinfo *ti;
- if (acb == NULL)
+ if (acb == NULL) {
printf("%s: COMPLETE with no active command?\n",
sc->sc_dev.dv_xname);
+ return (0);
+ }
#ifdef OSIOP_DEBUG
if (osiop_read_4(sc, OSIOP_DSA) !=
dsdma->dm_segs[0].ds_addr + acb->dsoffset) {
@@ -1207,9 +1209,11 @@ osiop_checkintr(sc, istat, dstat, sstat0, status)
return (1);
}
if (dstat & OSIOP_DSTAT_SIR && intcode == A_int_syncmsg) {
- if (acb == NULL)
+ if (acb == NULL) {
printf("%s: Sync message with no active command?\n",
sc->sc_dev.dv_xname);
+ return (0);
+ }
target = acb->xs->sc_link->target;
if (ds->msgbuf[1] == MSG_EXTENDED &&
ds->msgbuf[2] == MSG_EXT_SDTR_LEN &&
@@ -1250,9 +1254,11 @@ osiop_checkintr(sc, istat, dstat, sstat0, status)
#ifdef OSIOP_DEBUG
osiopphmm++;
#endif
- if (acb == NULL)
+ if (acb == NULL) {
printf("%s: Phase mismatch with no active command?\n",
sc->sc_dev.dv_xname);
+ return (0);
+ }
if (acb->datalen > 0) {
int adjust = (dfifo - (dbc & 0x7f)) & 0x7f;
if (sstat1 & OSIOP_SSTAT1_ORF)
@@ -1321,9 +1327,11 @@ osiop_checkintr(sc, istat, dstat, sstat0, status)
}
if (sstat0 & OSIOP_SSTAT0_STO) {
/* Select timed out */
- if (acb == NULL)
+ if (acb == NULL) {
printf("%s: Select timeout with no active command?\n",
sc->sc_dev.dv_xname);
+ return (0);
+ }
#ifdef OSIOP_DEBUG
if (osiop_read_1(sc, OSIOP_SBCL) & OSIOP_BSY) {
printf("ACK! osiop was busy at timeout: "
@@ -1631,9 +1639,11 @@ osiop_checkintr(sc, istat, dstat, sstat0, status)
}
if (dstat & OSIOP_DSTAT_SIR && intcode == A_int_msgin) {
/* Unrecognized message in byte */
- if (acb == NULL)
+ if (acb == NULL) {
printf("%s: Bad message-in with no active command?\n",
sc->sc_dev.dv_xname);
+ return (0);
+ }
printf("%s: Unrecognized message in data "
"sfbr %x msg %x sbcl %x\n", sc->sc_dev.dv_xname,
osiop_read_1(sc, OSIOP_SFBR), ds->msgbuf[1],