From assar@sics.se Thu May 20 12:25:51 1999
Return-Path: <assar@sics.se>
Received: from assaris.sics.se (assaris.sics.se [193.10.66.108])
	by hub.freebsd.org (Postfix) with ESMTP id DBED115670
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 20 May 1999 12:25:48 -0700 (PDT)
	(envelope-from assar@sics.se)
Received: (from assar@localhost) by assaris.sics.se (8.9.3/8.7.3) id VAA37960; Thu, 20 May 1999 21:29:07 +0200 (CEST)
Message-Id: <199905201929.VAA37960@assaris.sics.se>
Date: Thu, 20 May 1999 21:29:07 +0200 (CEST)
From: assar@sics.se
To: FreeBSD-gnats-submit@freebsd.org
Subject: inthand_remove doesn't remove unshared interrupts correctly
X-Send-Pr-Version: 3.2

>Number:         11806
>Category:       i386
>Synopsis:       inthand_remove doesn't remove unshared interrupts correctly
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 20 12:30:01 PDT 1999
>Closed-Date:    Sat May 22 03:10:47 PDT 1999
>Last-Modified:  Sat May 22 03:11:33 PDT 1999
>Originator:     Assar Westerlund
>Release:        FreeBSD 4.0-CURRENT i386
>Organization:
none
>Environment:

FreeBSD 4.0-current

>Description:

When inthand_remove is called on an unshared interrupt it doesn't
manage to reset back the handler to the one handling stray interrupts.

This also manifests itself with the machine panic:ing after removing
pccards or sleeping it.

>How-To-Repeat:

zzz

or

remove pccard


>Fix:

Index: sys/i386/isa/intr_machdep.c
===================================================================
RCS file: /src/fbsd-repository/src/sys/i386/isa/intr_machdep.c,v
retrieving revision 1.21
diff -u -w -u -w -r1.21 intr_machdep.c
--- intr_machdep.c	1999/05/04 21:18:20	1.21
+++ intr_machdep.c	1999/05/17 02:15:18
@@ -823,12 +823,11 @@
 
 		oldspl = splq(1 << irq);
 
-		/* we want to remove the list head, which was known to intr_mux */
-		icu_unset(irq, intr_mux);
 
 		/* check whether the new list head is the only element on list */
 		head = intreclist_head[irq];
 		if (head != NULL) {
+			icu_unset(irq, intr_mux);
 			if (head->next != NULL) {
 				/* install the multiplex handler with new list head as argument */
 				errcode = icu_setup(irq, intr_mux, head, 0, 0);
@@ -842,6 +841,8 @@
 				if (errcode == 0)
 					update_intrname(irq, head->name);
 			}
+		} else {
+			icu_unset(irq, idesc->handler);
 		}
 		splx(oldspl);
 	}

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: peter 
State-Changed-When: Sat May 22 03:10:47 PDT 1999 
State-Changed-Why:  
Suggested fix applied in intr_machdep.c rev 1.22 
>Unformatted:
