[PATCH] pcmcia driver model support [4/5]

Adam Belay ambx1 at neo.rr.com
Thu Aug 5 18:28:20 EDT 2004

[PCMCIA] fix eject lockup

It is not safe to use the skt_sem in pcmcia_validate_mem.  This patch fixes a
real world bug, and without it many systems will fail to shutdown properly. When
pcmcia-cs calls DS_EJECT_CARD, it creates a CS_EVENT_EJECTION_REQUEST event.
The event is then eventually reported to the ds.c client.  DS then informs
userspace of the ejection request and waits for userspace to reply with whether
the request was successful.  pcmcia-cs, in turn, calls DS_GET_FIRST_TUPLE while
verifying the ejection request.  Unfortunately, at this point the skt_sem
semaphore is already held by pcmcia_eject_card.  This results in the ds event
code waiting forever for skt_sem to become available.

--- a/drivers/pcmcia/rsrc_mgr.c	2004-08-05 13:05:45.000000000 +0000
+++ b/drivers/pcmcia/rsrc_mgr.c	2004-08-05 21:31:32.000000000 +0000
@@ -520,12 +520,8 @@
 void pcmcia_validate_mem(struct pcmcia_socket *s)
-	down(&s->skt_sem);
 	if (probe_mem && s->state & SOCKET_PRESENT)
-	up(&s->skt_sem);

More information about the linux-pcmcia mailing list