diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2010-01-12 21:42:51 +0100 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2010-02-17 17:48:13 +0100 |
commit | 6b8e087b86c59c3941e125738d30cf38014089e0 (patch) | |
tree | 08f77e50e5237e3bbe5e4c8f114fddc09f242628 /drivers/pcmcia/rsrc_nonstatic.c | |
parent | c6958fdb041db6ed77f24e871dd4af5f059d1a2b (diff) | |
download | blackbird-op-linux-6b8e087b86c59c3941e125738d30cf38014089e0.tar.gz blackbird-op-linux-6b8e087b86c59c3941e125738d30cf38014089e0.zip |
pcmcia: add locking to set_mem_map()
Protect the pccard_operations callback "set_mem_map" by a new
mutex ops_mutex. This mutex also protects the following values
in struct pcmcia_socket:
pccard_mem_map win[]
pccard_mem_map cis_mem
void __iomem *cis_virt
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia/rsrc_nonstatic.c')
-rw-r--r-- | drivers/pcmcia/rsrc_nonstatic.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c index 91626c17f97b..1de46cf2772f 100644 --- a/drivers/pcmcia/rsrc_nonstatic.c +++ b/drivers/pcmcia/rsrc_nonstatic.c @@ -274,17 +274,21 @@ static int readable(struct pcmcia_socket *s, struct resource *res, { int ret = -EINVAL; + mutex_lock(&s->ops_mutex); s->cis_mem.res = res; s->cis_virt = ioremap(res->start, s->map_size); if (s->cis_virt) { + mutex_unlock(&s->ops_mutex); /* as we're only called from pcmcia.c, we're safe */ if (s->callback->validate) ret = s->callback->validate(s, count); /* invalidate mapping */ + mutex_lock(&s->ops_mutex); iounmap(s->cis_virt); s->cis_virt = NULL; } s->cis_mem.res = NULL; + mutex_unlock(&s->ops_mutex); if ((ret) || (*count == 0)) return -EINVAL; return 0; @@ -300,6 +304,8 @@ static int checksum(struct pcmcia_socket *s, struct resource *res, int i, a = 0, b = -1, d; void __iomem *virt; + mutex_lock(&s->ops_mutex); + virt = ioremap(res->start, s->map_size); if (virt) { map.map = 0; @@ -322,6 +328,8 @@ static int checksum(struct pcmcia_socket *s, struct resource *res, iounmap(virt); } + mutex_unlock(&s->ops_mutex); + if (b == -1) return -EINVAL; |