[RFC] PCMCIA patches for 2.6.34

Wolfram Sang w.sang at pengutronix.de
Mon Jan 11 17:01:49 EST 2010


Hiya Dominik,

thanks for your assistance!

> Not known to me -- does it also happen with pata_pcmcia.c?

Nope, it doesn't. Never noticed this driver :)

> (1) diff between /proc/ioports before and after inserting the card. Extra
> bonus i you can grab a /proc/ioports before the ide-cs driver is loaded
> (e.g. by moving it away from /lib/modules/... and then insmod'ing it
> manually).

The ports definately have been assigned before (the card is working), I always
had the impression there was a double-free going on.

Knowing now that this is a flaw, I digged up something, check the following
call chain in ide_detach from ide-cs.c:

ide_release -> pcmcia_disable_device -> pcmcia_release_io

Then(!) release_region is called twice, but the io-resources are gone by now.
From what I see, I'd suggest the following patch which makes the warnings go
away for me. To me, it looks correct. I just wonder as this seems to have gone
unnoticed for quite a while. If you think this rfc is correct, I will create a
proper patch out of it and remove the shadowing introduced by
fbc69fd9b76158daaa83e5372e44fdd81df20f92.

Regards,

   Wolfram

diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c
index dd63963..ef7b61e 100644
--- a/drivers/ide/ide-cs.c
+++ b/drivers/ide/ide-cs.c
@@ -129,11 +129,11 @@ static void ide_detach(struct pcmcia_device *link)
     data_addr = hwif->io_ports.data_addr;
     ctl_addr  = hwif->io_ports.ctl_addr;
 
-    ide_release(link);
-
     release_region(ctl_addr, 1);
     release_region(data_addr, 8);
 
+    ide_release(link);
+
     kfree(info);
 } /* ide_detach */

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-pcmcia/attachments/20100111/58d34b43/attachment.sig>


More information about the linux-pcmcia mailing list