Subject: Re: Crash when removing cardbus card
To: None <peter.postma@chello.nl>
From: Masanori Kanaoka <kanaoka@ann.hi-ho.ne.jp>
List: current-users
Date: 03/11/2004 21:28:49
----Security_Multipart(Thu_Mar_11_21_28_49_2004_908)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi,

       From: Peter Postma <peter.postma@chello.nl>
    Subject: Crash when removing cardbus card
      Date : Wed, 10 Mar 2004 12:10:29 +0100
 Message-ID: <20040310111029.GA27448@gateway.pointless.nl>

$ My laptop crashes when I remove the cardbus card:
$ 
$ tqphy0 detached
$ cardbus0: unmap mem space
$ tlp0 detached
$ uvm_fault(0xc035b680, 0xc02f3000, 0, 2) -> 0xe
$ kernel: page fault trap, code=0
$ Stopped in pid 6.1 (cardslot0) at	netbsd:pccbb_intr_disestablish+0x19:movl %eax,0x10(%edx)

I had a similar experience with rtk_cardbus.
When cardbus_intr_disestablish() has done in rtk_cardbus_disable(),
csc->sc_ih does not set NULL.So kernel panic,when card removed
after "ifconfig rtk0 up;ifconfig rtk0 down".

I think that com_cardbus has a same problem.

How about trying next patch?
I hope that it may fix your problem.

Best Regards
---
 Masanori Kanaoka	kanaoka@ann.hi-ho.ne.jp


Index: sys/dev/cardbus/com_cardbus.c
===================================================================
RCS file: /ftp/cvs/src/sys/dev/cardbus/com_cardbus.c,v
retrieving revision 1.9
diff -u -r1.9 com_cardbus.c
--- sys/dev/cardbus/com_cardbus.c	2 Oct 2002 16:33:41 -0000	1.9
+++ sys/dev/cardbus/com_cardbus.c	11 Mar 2004 08:07:12 -0000
@@ -322,6 +322,8 @@
 	cardbus_function_tag_t cf = psc->sc_cf;
 
 	cardbus_intr_disestablish(cc, cf, csc->cc_ih);
+	csc->cc_ih = NULL;
+
 	Cardbus_function_disable(csc->cc_ct);
 }
 
@@ -336,7 +338,8 @@
 	if ((error = com_detach(self, flags)) != 0)
 		return error;
 
-	cardbus_intr_disestablish(psc->sc_cc, psc->sc_cf, csc->cc_ih);
+	if (csc->cc_ih != NULL)
+		cardbus_intr_disestablish(psc->sc_cc, psc->sc_cf, csc->cc_ih);
     
 	Cardbus_mapreg_unmap(csc->cc_ct, csc->cc_reg, sc->sc_iot, sc->sc_ioh, 
 			     csc->cc_size);


----Security_Multipart(Thu_Mar_11_21_28_49_2004_908)--
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (NetBSD)

iQEVAwUAQFBbmKZTiBfoL27MAQKx1ggAuaKbgdFMYKdrkGFky5IRDFyPUtlB+4Lp
0/KoJ29ah3OFPNCGDFryfdJ7qMKev1vbzaA1+DqHjRu7H7X5vbjl2lS5QsKvtfyc
HjdVEsBDcmq/i2VniLpkjiakyzeSuF2Q5SCZnJ80QMuKCWsyYZhf+j2JsUUt5Bjx
YhvsmMUbtctvOgXEoLN0Z7Y8JTWzERX2qShUkRwl3W6eNvxFHkgScIiqOfA3pVGk
3q2iS9YT5ipDxviyJDD8B21PIOGBZwnAvk8V1LsXrOCxdkW/JmMaC3I9yI71zrWN
Fo3tB3oVijNCUlzvMEsmgXWCQk5/KUiOwYdJMb/UQ1Miwki7AyBGAg==
=h3Bs
-----END PGP SIGNATURE-----

----Security_Multipart(Thu_Mar_11_21_28_49_2004_908)----