aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Ritz <daniel.ritz@gmx.ch>2005-09-09 16:03:23 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-09 16:57:47 -0400
commitbf4de6f2db79f3c396bd884f546cd2ea91a686f2 (patch)
tree6d2dc0b8ba8b91ea75d57c018d3958142c25eaef
parentb3743fa4442fc172e950ff0eaf6aa96e7d5ce9be (diff)
[PATCH] pcmcia/cs: fix possible missed wakeup
- thread_done should only be completed when the wait_queue is installed. - all wake up conditions should be checked before schedule() this fixes a hang of rmmod in the sequence modprobe yenta_socket; rmmod yenta_socket as reported by Andreas Steinmetz. w/o this rmmod yenta_socket can hang on wait_for_completion() in pcmcia_unregister_socket() Signed-off-by: Daniel Ritz <daniel.ritz@gmx.ch> Cc: Dominik Brodowski <linux@brodo.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/pcmcia/cs.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index e39178fc59d0..fabd3529cebc 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -654,9 +654,10 @@ static int pccardd(void *__skt)
654 skt->thread = NULL; 654 skt->thread = NULL;
655 complete_and_exit(&skt->thread_done, 0); 655 complete_and_exit(&skt->thread_done, 0);
656 } 656 }
657 complete(&skt->thread_done);
658 657
659 add_wait_queue(&skt->thread_wait, &wait); 658 add_wait_queue(&skt->thread_wait, &wait);
659 complete(&skt->thread_done);
660
660 for (;;) { 661 for (;;) {
661 unsigned long flags; 662 unsigned long flags;
662 unsigned int events; 663 unsigned int events;
@@ -682,11 +683,11 @@ static int pccardd(void *__skt)
682 continue; 683 continue;
683 } 684 }
684 685
685 schedule();
686 try_to_freeze();
687
688 if (!skt->thread) 686 if (!skt->thread)
689 break; 687 break;
688
689 schedule();
690 try_to_freeze();
690 } 691 }
691 remove_wait_queue(&skt->thread_wait, &wait); 692 remove_wait_queue(&skt->thread_wait, &wait);
692 693