diff options
author | Jeff Hartmann <jhartmann@valinux.com> | 2000-03-16 19:28:27 +0000 |
---|---|---|
committer | Jeff Hartmann <jhartmann@valinux.com> | 2000-03-16 19:28:27 +0000 |
commit | 45b7b67d2599907d223f454af5e3e7e4f62a709a (patch) | |
tree | a99bc9b5c6def9582ddea4867f15a38813fb1d2a | |
parent | 3f212ea971dea919bf4eeb3fccea8c71981c985e (diff) |
Added mmap semaphore around do_mmap
-rw-r--r-- | linux/i810_bufs.c | 4 | ||||
-rw-r--r-- | linux/mga_bufs.c | 11 |
2 files changed, 11 insertions, 4 deletions
diff --git a/linux/i810_bufs.c b/linux/i810_bufs.c index 5c3adfad..be041f14 100644 --- a/linux/i810_bufs.c +++ b/linux/i810_bufs.c @@ -380,11 +380,15 @@ int i810_mapbufs(struct inode *inode, struct file *filp, unsigned int cmd, DRM_DEBUG("map->flags : %x\n", map->flags); DRM_DEBUG("map->handle : %lx\n", map->handle); DRM_DEBUG("map->mtrr : %d\n", map->mtrr); + down(¤t->mm->mmap_sem); virtual = do_mmap(filp, 0, map->size, PROT_READ|PROT_WRITE, MAP_SHARED, (unsigned long)map->offset); + up(¤t->mm->mmap_sem); } else { + down(¤t->mm->mmap_sem); virtual = do_mmap(filp, 0, dma->byte_count, PROT_READ|PROT_WRITE, MAP_SHARED, 0); + up(¤t->mm->mmap_sem); } if (virtual > -1024UL) { /* Real error */ diff --git a/linux/mga_bufs.c b/linux/mga_bufs.c index a160b312..89e4090d 100644 --- a/linux/mga_bufs.c +++ b/linux/mga_bufs.c @@ -546,7 +546,7 @@ int mga_mapbufs(struct inode *inode, struct file *filp, unsigned int cmd, spin_lock(&dev->count_lock); if (atomic_read(&dev->buf_alloc)) { spin_unlock(&dev->count_lock); - DRM_DEBUG("Buzy\n"); + DRM_DEBUG("Busy\n"); return -EBUSY; } ++dev->buf_use; /* Can't allocate more after this call */ @@ -578,12 +578,15 @@ int mga_mapbufs(struct inode *inode, struct file *filp, unsigned int cmd, DRM_DEBUG("map->flags : %x\n", map->flags); DRM_DEBUG("map->handle : %p\n", map->handle); DRM_DEBUG("map->mtrr : %d\n", map->mtrr); - + down(¤t->mm->mmap_sem); virtual = do_mmap(filp, 0, map->size, PROT_READ|PROT_WRITE, MAP_SHARED, (unsigned long)map->offset); + up(¤t->mm->mmap_sem); } else { - virtual = do_mmap(filp, 0, dma->byte_count, - PROT_READ|PROT_WRITE, MAP_SHARED, 0); + down(¤t->mm->mmap_sem); + virtual = do_mmap(filp, 0, dma->byte_count, + PROT_READ|PROT_WRITE, MAP_SHARED, 0); + up(¤t->mm->mmap_sem); } if (virtual > -1024UL) { /* Real error */ |