pcmcia: properly lock skt->irq, skt->irq_mask
authorDominik Brodowski <linux@dominikbrodowski.net>
Sat, 16 Jan 2010 00:14:38 +0000 (01:14 +0100)
committerDominik Brodowski <linux@dominikbrodowski.net>
Wed, 17 Feb 2010 16:48:17 +0000 (17:48 +0100)
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
drivers/pcmcia/pcmcia_resource.c
drivers/pcmcia/socket_sysfs.c

index f365ecb9c5cd1b09d58871ed2d8e3b3c37cfdb67..f0de7b8b123ba92ce3bccb11d74e511444bbd5aa 100644 (file)
@@ -419,7 +419,9 @@ static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req)
                dev_dbg(&s->dev, "IRQ attributes must match assigned ones\n");
                return -EINVAL;
        }
+       mutex_lock(&s->ops_mutex);
        if (s->irq.AssignedIRQ != req->AssignedIRQ) {
+               mutex_unlock(&s->ops_mutex);
                dev_dbg(&s->dev, "IRQ must match assigned one\n");
                return -EINVAL;
        }
@@ -434,6 +436,7 @@ static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req)
 #ifdef CONFIG_PCMCIA_PROBE
        pcmcia_used_irq[req->AssignedIRQ]--;
 #endif
+       mutex_unlock(&s->ops_mutex);
 
        return 0;
 } /* pcmcia_release_irq */
index 537d79305e7a19318f5030bf4284233491eca74c..1cba9d38d8132f4ea91eb7abaeaef75601db47d4 100644 (file)
@@ -167,7 +167,9 @@ static ssize_t pccard_store_irq_mask(struct device *dev,
        ret = sscanf(buf, "0x%x\n", &mask);
 
        if (ret == 1) {
+               mutex_lock(&s->ops_mutex);
                s->irq_mask &= mask;
+               mutex_unlock(&s->ops_mutex);
                ret = 0;
        }