summaryrefslogtreecommitdiff
path: root/linux/bufs.c
diff options
context:
space:
mode:
authorRik Faith <faith@alephnull.com>2000-07-19 18:38:41 +0000
committerRik Faith <faith@alephnull.com>2000-07-19 18:38:41 +0000
commitaed8549e91ade1582505ebce50e4a79d99b4436f (patch)
tree75fae913a2327facdbd944b373a7e9ebe4ec9c8c /linux/bufs.c
parent7b888f87fa5ec559df97a7e911dd5a3328895f6f (diff)
Sync with Linux 2.4.0-test4 kernel
Diffstat (limited to 'linux/bufs.c')
-rw-r--r--linux/bufs.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/linux/bufs.c b/linux/bufs.c
index 011e4241..fd3b1248 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)) {
@@ -484,8 +486,10 @@ int drm_mapbufs(struct inode *inode, struct file *filp, unsigned int cmd,
-EFAULT);
if (request.count >= dma->buf_count) {
+ down(&current->mm->mmap_sem);
virtual = do_mmap(filp, 0, dma->byte_count,
PROT_READ|PROT_WRITE, MAP_SHARED, 0);
+ up(&current->mm->mmap_sem);
if (virtual > -1024UL) {
/* Real error */
retcode = (signed long)virtual;