Skip to content

Commit

Permalink
[PATCH] zd1211rw: Fix of a locking bug
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ulrich Kunitz authored and John W. Linville committed Nov 28, 2006
1 parent a3df3b6 commit a68077d
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions drivers/net/wireless/zd1211rw/zd_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,15 +366,6 @@ static int upload_firmware(struct usb_device *udev, u8 device_type)
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)
Expand Down Expand Up @@ -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,
Expand All @@ -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.
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit a68077d

Please sign in to comment.