Skip to content

Commit 4e5518c

Browse files
Stanislaw Gruszkalinvjw
authored andcommitted
hostap_cs: fix sleeping function called from invalid context
pcmcia_request_irq() and pcmcia_enable_device() are intended to be called from process context (first function allocate memory with GFP_KERNEL, second take a mutex). We can not take spin lock and call them. It's safe to move spin lock after pcmcia_enable_device() as we still hold off IRQ until dev->base_addr is 0 and driver will not proceed with interrupts when is not ready. Patch resolves: https://bugzilla.redhat.com/show_bug.cgi?id=643758 Reported-and-tested-by: rbugz@biobind.com Cc: stable@kernel.org # 2.6.34+ Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 3c4a8cc commit 4e5518c

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

‎drivers/net/wireless/hostap/hostap_cs.c‎

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -518,22 +518,21 @@ static int prism2_config(struct pcmcia_device *link)
518518
hw_priv->link = link;
519519

520520
/*
521-
* Make sure the IRQ handler cannot proceed until at least
522-
* dev->base_addr is initialized.
521+
* We enable IRQ here, but IRQ handler will not proceed
522+
* until dev->base_addr is set below. This protect us from
523+
* receive interrupts when driver is not initialized.
523524
*/
524-
spin_lock_irqsave(&local->irq_init_lock, flags);
525-
526525
ret = pcmcia_request_irq(link, prism2_interrupt);
527526
if (ret)
528-
goto failed_unlock;
527+
goto failed;
529528

530529
ret = pcmcia_enable_device(link);
531530
if (ret)
532-
goto failed_unlock;
531+
goto failed;
533532

533+
spin_lock_irqsave(&local->irq_init_lock, flags);
534534
dev->irq = link->irq;
535535
dev->base_addr = link->resource[0]->start;
536-
537536
spin_unlock_irqrestore(&local->irq_init_lock, flags);
538537

539538
local->shutdown = 0;
@@ -546,8 +545,6 @@ static int prism2_config(struct pcmcia_device *link)
546545

547546
return ret;
548547

549-
failed_unlock:
550-
spin_unlock_irqrestore(&local->irq_init_lock, flags);
551548
failed:
552549
kfree(hw_priv);
553550
prism2_release((u_long)link);

0 commit comments

Comments
 (0)