Bug 147127 - [pccard] [patch] Fix panic in pccard.c
Summary: [pccard] [patch] Fix panic in pccard.c
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 9.0-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: Warner Losh
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-27 12:40 UTC by Hans Petter Selasky
Modified: 2021-07-04 01:56 UTC (History)
1 user (show)

See Also:
imp: mfc-stable12+
imp: mfc-stable11+
imp: mfc-stable10+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hans Petter Selasky 2010-05-27 12:40:02 UTC
When inserting a PCCARD a panic can occur if the PCCARD generate interrupts
before the driver is loaded.

Fix: 

--- dev/pccard/pccard.c (revision 208027)
+++ dev/pccard/pccard.c (local)
@@ -1258,7 +1258,10 @@
 pccard_intr(void *arg)
 {
        struct pccard_function *pf = (struct pccard_function*) arg;
-       
+
+        if (pf->intr_handler == NULL)
+                return;                 /* can happen during PCCARD insertion 
*/
+       
        pf->intr_handler(pf->intr_handler_arg); 
 }
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2012-05-10 19:18:52 UTC
Responsible Changed
From-To: freebsd-bugs->eadler

I'll take it.
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2012-05-13 17:00:22 UTC
State Changed
From-To: open->analyzed

awaiting approval
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2012-06-13 06:43:27 UTC
State Changed
From-To: analyzed->open

needs more information, seems to be the wrong thing
Comment 4 Hans Petter Selasky 2012-06-13 07:30:09 UTC
On Wednesday 13 June 2012 07:43:28 eadler@freebsd.org wrote:
> Synopsis: [pccard] [patch] Fix panic in pccard.c
> 
> State-Changed-From-To: analyzed->open
> State-Changed-By: eadler
> State-Changed-When: Wed Jun 13 05:43:27 UTC 2012
> State-Changed-Why:
> needs more information, seems to be the wrong thing
> 
> http://www.freebsd.org/cgi/query-pr.cgi?pr=147127

I can try to reproduce using 9-stable. It might take some time.

--HPS
Comment 5 Eitan Adler freebsd_committer freebsd_triage 2012-06-14 06:55:23 UTC
Responsible Changed
From-To: eadler->hselasky

over to committer
Comment 6 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:01:35 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 7 commit-hook freebsd_committer freebsd_triage 2019-01-07 06:19:59 UTC
A commit references this bug:

Author: imp
Date: Mon Jan  7 06:19:51 UTC 2019
New revision: 342843
URL: https://svnweb.freebsd.org/changeset/base/342843

Log:
  Fix a race between setting up the interrupt handler and it firing by
  setting the data prior to setting up the interrupt. Now we only set
  the cookie afterwards, and that (a) cannot be helpd and (b) isn't used
  in the ISR.

  PR: 147127
  Submitted by: hps@

Changes:
  head/sys/dev/pccard/pccard.c
Comment 8 Warner Losh freebsd_committer freebsd_triage 2019-01-07 06:21:24 UTC
Fixed the race by setting the data before setting up the ISR.
Please contact me if there are other, unanticipated issues relating to this.
Forgot the MFC tag in my commit.