summary refs log tree commit diff
path: root/drivers/net/wireless/hostap/hostap_hw.c
diff options
context:
space:
mode:
authorTim Gardner <tim.gardner@canonical.com>2010-06-08 11:33:02 -0600
committerJohn W. Linville <linville@tuxdriver.com>2010-06-15 15:44:41 -0400
commitd6a574ff6bfb842bdb98065da053881ff527be46 (patch)
tree899cdc5cdfc75d21a8c258ecfc2bc6b1e1c79895 /drivers/net/wireless/hostap/hostap_hw.c
parenta69b03e941abae00380fc6bc1877fb797a1b31e6 (diff)
downloadlinux-d6a574ff6bfb842bdb98065da053881ff527be46.tar.gz
hostap: Protect against initialization interrupt
Use an irq spinlock to hold off the IRQ handler until
enough early card init is complete such that the handler
can run without faulting.

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Cc: stable@kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/hostap/hostap_hw.c')
-rw-r--r--drivers/net/wireless/hostap/hostap_hw.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c
index ff9b5c882184..2f999fc94f60 100644
--- a/drivers/net/wireless/hostap/hostap_hw.c
+++ b/drivers/net/wireless/hostap/hostap_hw.c
@@ -2621,6 +2621,18 @@ static irqreturn_t prism2_interrupt(int irq, void *dev_id)
 	iface = netdev_priv(dev);
 	local = iface->local;
 
+	/* Detect early interrupt before driver is fully configued */
+	spin_lock(&local->irq_init_lock);
+	if (!dev->base_addr) {
+		if (net_ratelimit()) {
+			printk(KERN_DEBUG "%s: Interrupt, but dev not configured\n",
+			       dev->name);
+		}
+		spin_unlock(&local->irq_init_lock);
+		return IRQ_HANDLED;
+	}
+	spin_unlock(&local->irq_init_lock);
+
 	prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INTERRUPT, 0, 0);
 
 	if (local->func->card_present && !local->func->card_present(local)) {
@@ -3138,6 +3150,7 @@ prism2_init_local_data(struct prism2_helper_functions *funcs, int card_idx,
 	spin_lock_init(&local->cmdlock);
 	spin_lock_init(&local->baplock);
 	spin_lock_init(&local->lock);
+	spin_lock_init(&local->irq_init_lock);
 	mutex_init(&local->rid_bap_mtx);
 
 	if (card_idx < 0 || card_idx >= MAX_PARM_DEVICES)