]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[PATCH] zd1211rw: Fix of a locking bug
authorUlrich Kunitz <kune@deine-taler.de>
Wed, 22 Nov 2006 00:06:06 +0000 (00:06 +0000)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 28 Nov 2006 19:10:48 +0000 (14:10 -0500)
This patch fixes the bug as reported in the kernel bug tracker
under the id 7244. The bug was simply that the interrupt lock has
been locked outside an interrupt without blocking the interrupt.

Signed-off-by: Ulrich Kunitz <kune@deine-taler.de>
Signed-off-by: Daniel Drake <dsd@gentoo.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/zd1211rw/zd_usb.c

index 3faaeb2b7c89c9843c71cc1b5d953ba872a0be3c..a15b095492458e38ffd16b51867f407d814ad6ef 100644 (file)
@@ -366,15 +366,6 @@ error:
        return r;
 }
 
-static void disable_read_regs_int(struct zd_usb *usb)
-{
-       struct zd_usb_interrupt *intr = &usb->intr;
-
-       spin_lock(&intr->lock);
-       intr->read_regs_enabled = 0;
-       spin_unlock(&intr->lock);
-}
-
 #define urb_dev(urb) (&(urb)->dev->dev)
 
 static inline void handle_regs_int(struct urb *urb)
@@ -1156,10 +1147,19 @@ static void prepare_read_regs_int(struct zd_usb *usb)
 {
        struct zd_usb_interrupt *intr = &usb->intr;
 
-       spin_lock(&intr->lock);
+       spin_lock_irq(&intr->lock);
        intr->read_regs_enabled = 1;
        INIT_COMPLETION(intr->read_regs.completion);
-       spin_unlock(&intr->lock);
+       spin_unlock_irq(&intr->lock);
+}
+
+static void disable_read_regs_int(struct zd_usb *usb)
+{
+       struct zd_usb_interrupt *intr = &usb->intr;
+
+       spin_lock_irq(&intr->lock);
+       intr->read_regs_enabled = 0;
+       spin_unlock_irq(&intr->lock);
 }
 
 static int get_results(struct zd_usb *usb, u16 *values,
@@ -1171,7 +1171,7 @@ static int get_results(struct zd_usb *usb, u16 *values,
        struct read_regs_int *rr = &intr->read_regs;
        struct usb_int_regs *regs = (struct usb_int_regs *)rr->buffer;
 
-       spin_lock(&intr->lock);
+       spin_lock_irq(&intr->lock);
 
        r = -EIO;
        /* The created block size seems to be larger than expected.
@@ -1204,7 +1204,7 @@ static int get_results(struct zd_usb *usb, u16 *values,
 
        r = 0;
 error_unlock:
-       spin_unlock(&intr->lock);
+       spin_unlock_irq(&intr->lock);
        return r;
 }