diff options
Diffstat (limited to 'linux/bufs.c')
-rw-r--r-- | linux/bufs.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/linux/bufs.c b/linux/bufs.c index 011e4241..c00f051a 100644 --- a/linux/bufs.c +++ b/linux/bufs.c @@ -72,12 +72,14 @@ int drm_addmap(struct inode *inode, struct file *filp, unsigned int cmd, switch (map->type) { case _DRM_REGISTERS: - case _DRM_FRAME_BUFFER: + case _DRM_FRAME_BUFFER: +#ifndef __sparc__ if (map->offset + map->size < map->offset || map->offset < virt_to_phys(high_memory)) { drm_free(map, sizeof(*map), DRM_MEM_MAPS); return -EINVAL; } +#endif #ifdef CONFIG_MTRR if (map->type == _DRM_FRAME_BUFFER || (map->flags & _DRM_WRITE_COMBINING)) { @@ -104,7 +106,7 @@ int drm_addmap(struct inode *inode, struct file *filp, unsigned int cmd, dev->lock.hw_lock = map->handle; /* Pointer to lock */ } break; -#ifdef DRM_AGP +#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) case _DRM_AGP: map->offset = map->offset + dev->agp->base; break; @@ -484,8 +486,10 @@ int drm_mapbufs(struct inode *inode, struct file *filp, unsigned int cmd, -EFAULT); if (request.count >= dma->buf_count) { + 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 */ retcode = (signed long)virtual; |