drm/radeon/kms: add missing copy from user
authorDr. David Alan Gilbert <linux@treblig.org>
Sun, 1 Aug 2010 23:43:52 +0000 (09:43 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 9 Aug 2010 22:13:55 +0000 (08:13 +1000)
This hasn't mattered up until the ioctl started using the value, and it fell
apart.

fixes fd.o 29340, Ubuntu LP 606081

[airlied: cleaned up whitespace and don't need an error before pushing]

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/radeon/radeon_kms.c

index ddcd3b13f15162cc9db280087b480a8171de8e30..948a2f454e426eaad1c97334263bb925df8efecf 100644 (file)
@@ -112,7 +112,9 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
 
        info = data;
        value_ptr = (uint32_t *)((unsigned long)info->value);
-       value = *value_ptr;
+       if (DRM_COPY_FROM_USER(&value, value_ptr, sizeof(value)))
+               return -EFAULT;
+
        switch (info->request) {
        case RADEON_INFO_DEVICE_ID:
                value = dev->pci_device;