lkml.org 
[lkml]   [2003]   [Mar]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] crash in pcmcia_access_configuration_register
Hello!

As promised, here's the patch to fix an oops in the kernel PCMCIA driver.
The patch should be applied both to 2.4 and 2.5 series.

How to reproduce the bug:

1) Compile and install HostAP (http://hostap.epitest.fi/) - any recent
version (CVS version is OK).

2) Insert a card supported by HostAP.

3) Remove (physically) the card. The kernel oopses.

Explanation:

While doing a reset, HostAP used AccessConfigurationRegister request to
preserve the value of the configuration register. The reset is triggered
by the removal of the card.

I do believe that HostAP can be improved to avoid reset if the socket
configuration has been released. Nevertheless, oops is not a reputable
behavior when the driver merely requests a configuration register.

The pcmcia-cs driver already has a slightly different protection, but the
following patch is simpler and addresses the problem right before it
happens.

====================================
--- drivers/pcmcia/cs.c
+++ drivers/pcmcia/cs.c
@@ -882,6 +882,10 @@ int pcmcia_access_configuration_register
c = &s->config[reg->Function];
} else
c = CONFIG(handle);
+
+ if (c == NULL)
+ return CS_NO_CARD;
+
if (!(c->state & CONFIG_LOCKED))
return CS_CONFIGURATION_LOCKED;

====================================
--
Regards,
Pavel Roskin
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:33    [W:0.044 / U:0.628 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site