tree 6d2dc0b8ba8b91ea75d57c018d3958142c25eaef
parent b3743fa4442fc172e950ff0eaf6aa96e7d5ce9be
author Daniel Ritz <[EMAIL PROTECTED]> Sat, 10 Sep 2005 03:03:23 -0700
committer Linus Torvalds <[EMAIL PROTECTED]> Sat, 10 Sep 2005 03:57:47 -0700

[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 <[EMAIL PROTECTED]>
Cc: Dominik Brodowski <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>

 drivers/pcmcia/cs.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -654,9 +654,10 @@ static int pccardd(void *__skt)
                skt->thread = NULL;
                complete_and_exit(&skt->thread_done, 0);
        }
-       complete(&skt->thread_done);
 
        add_wait_queue(&skt->thread_wait, &wait);
+       complete(&skt->thread_done);
+
        for (;;) {
                unsigned long flags;
                unsigned int events;
@@ -682,11 +683,11 @@ static int pccardd(void *__skt)
                        continue;
                }
 
-               schedule();
-               try_to_freeze();
-
                if (!skt->thread)
                        break;
+
+               schedule();
+               try_to_freeze();
        }
        remove_wait_queue(&skt->thread_wait, &wait);
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to