summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2014-08-30 09:42:21 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2014-08-30 09:42:21 +0000
commit2519a19ba5e71f8a9622980d221d42c3a82412a6 (patch)
treecaf6b05b494cd4f084570c7e52f7d80aeffa0312 /sys/arch
parentd1816807c5bb5aa346f22dc2b3155142ee5a3276 (diff)
Don't panic when an illegal IRQ is passed to intr_{dis,}establish().
At least the device-tree for the second bge(4) on my PowerMac is not parsed correctly but we can live with that until the bug is fixed.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/macppc/dev/macintr.c16
-rw-r--r--sys/arch/macppc/dev/openpic.c18
2 files changed, 21 insertions, 13 deletions
diff --git a/sys/arch/macppc/dev/macintr.c b/sys/arch/macppc/dev/macintr.c
index 8e716c235c3..f5013891eaa 100644
--- a/sys/arch/macppc/dev/macintr.c
+++ b/sys/arch/macppc/dev/macintr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: macintr.c,v 1.47 2014/07/12 18:44:42 tedu Exp $ */
+/* $OpenBSD: macintr.c,v 1.48 2014/08/30 09:42:20 mpi Exp $ */
/*-
* Copyright (c) 2008 Dale Rahn <drahn@openbsd.org>
@@ -285,14 +285,16 @@ macintr_establish(void * lcv, int irq, int type, int level,
printf("macintr_establish, hI %d L %d %s", irq, level, ppc_intr_typename(type));
#endif
+ if (!LEGAL_IRQ(irq) || type == IST_NONE) {
+ printf("%s: bogus irq %d or type %d", __func__, irq, type);
+ return (NULL);
+ }
+
/* no point in sleeping unless someone can free memory. */
ih = malloc(sizeof *ih, M_DEVBUF, cold ? M_NOWAIT : M_WAITOK);
if (ih == NULL)
panic("intr_establish: can't malloc handler info");
- if (!LEGAL_IRQ(irq) || type == IST_NONE)
- panic("intr_establish: bogus irq or type");
-
iq = &macintr_handler[irq];
switch (iq->iq_ist) {
case IST_NONE:
@@ -344,8 +346,10 @@ macintr_disestablish(void *lcp, void *arg)
int s;
struct intrq *iq;
- if (!LEGAL_IRQ(irq))
- panic("intr_disestablish: bogus irq");
+ if (!LEGAL_IRQ(irq)) {
+ printf("%s: bogus irq %d", __func__, irq);
+ return;
+ }
/*
* Remove the handler from the chain.
diff --git a/sys/arch/macppc/dev/openpic.c b/sys/arch/macppc/dev/openpic.c
index 7167c801a53..41e66491bf8 100644
--- a/sys/arch/macppc/dev/openpic.c
+++ b/sys/arch/macppc/dev/openpic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: openpic.c,v 1.72 2014/07/12 18:44:42 tedu Exp $ */
+/* $OpenBSD: openpic.c,v 1.73 2014/08/30 09:42:20 mpi Exp $ */
/*-
* Copyright (c) 2008 Dale Rahn <drahn@openbsd.org>
@@ -307,15 +307,17 @@ openpic_intr_establish(void *lcv, int irq, int type, int level,
struct intrq *iq;
int s;
+ if (!LEGAL_IRQ(irq) || type == IST_NONE) {
+ printf("%s: bogus irq %d or type %d", __func__, irq, type);
+ return (NULL);
+ }
+
/* no point in sleeping unless someone can free memory. */
ih = malloc(sizeof *ih, M_DEVBUF, cold ? M_NOWAIT : M_WAITOK);
if (ih == NULL)
- panic("intr_establish: can't malloc handler info");
+ panic("%s: can't malloc handler info", __func__);
iq = &openpic_handler[irq];
- if (!LEGAL_IRQ(irq) || type == IST_NONE)
- panic("intr_establish: bogus irq or type");
-
switch (iq->iq_ist) {
case IST_NONE:
iq->iq_ist = type;
@@ -365,8 +367,10 @@ openpic_intr_disestablish(void *lcp, void *arg)
struct intrq *iq = &openpic_handler[irq];
int s;
- if (!LEGAL_IRQ(irq))
- panic("intr_disestablish: bogus irq");
+ if (!LEGAL_IRQ(irq)) {
+ printf("%s: bogus irq %d", __func__, irq);
+ return;
+ }
/*
* Remove the handler from the chain.