diff options
Diffstat (limited to 'linux-core')
-rw-r--r-- | linux-core/drm_bo.c | 43 | ||||
-rw-r--r-- | linux-core/drm_drv.c | 16 | ||||
-rw-r--r-- | linux-core/drm_ttm.c | 4 | ||||
-rw-r--r-- | linux-core/drm_ttm.h | 2 |
4 files changed, 14 insertions, 51 deletions
diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c index 35d4aba7..5eb09839 100644 --- a/linux-core/drm_bo.c +++ b/linux-core/drm_bo.c @@ -301,34 +301,6 @@ int drm_bo_alloc_space(drm_device_t *dev, int tt, drm_buffer_object_t *buf) } #endif -static int drm_do_bo_ioctl(drm_file_t *priv, int num_requests, - drm_bo_arg_data_t __user *data) -{ - drm_bo_arg_data_t arg; - drm_bo_arg_request_t *req = &arg.req; - drm_bo_arg_reply_t rep; - int i, ret; - - for (i=0; i<num_requests; ++i) { - rep.ret = 0; - ret = copy_from_user(&arg, (void __user *) data, sizeof(arg)); - if (ret) { - rep.ret = -EFAULT; - goto out_loop; - } - - arg.rep = rep; - data++; - out_loop: - arg.rep = rep; - ret = copy_to_user((void __user *) data, &arg, sizeof(arg)); - if (!ret) - ++i; - break; - } - return i; -} - int drm_bo_ioctl(DRM_IOCTL_ARGS) { @@ -336,21 +308,6 @@ int drm_bo_ioctl(DRM_IOCTL_ARGS) drm_bo_arg_t arg; unsigned long data_ptr; (void) dev; - - DRM_COPY_FROM_USER_IOCTL(arg, (void __user *)data, sizeof(arg)); - data_ptr = combine_64(arg.data_lo, arg.data_hi); - switch(arg.op) { - case drm_op_bo: - arg.num_requests = drm_do_bo_ioctl(priv, arg.num_requests, - (drm_bo_arg_data_t __user *) - data_ptr); - break; - case drm_op_ttm: - return drm_ttm_ioctl(priv, (drm_ttm_arg_t __user *) - data_ptr); - } - - DRM_COPY_TO_USER_IOCTL((void __user *) data, arg, sizeof(arg)); return 0; } diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c index e6ae690a..b33d1f14 100644 --- a/linux-core/drm_drv.c +++ b/linux-core/drm_drv.c @@ -120,6 +120,7 @@ static drm_ioctl_desc_t drm_ioctls[] = { [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK)] = {drm_wait_vblank, 0}, [DRM_IOCTL_NR(DRM_IOCTL_FENCE)] = {drm_fence_ioctl, DRM_AUTH}, + [DRM_IOCTL_NR(DRM_IOCTL_TTM)] = {drm_ttm_ioctl, DRM_AUTH}, }; #define DRIVER_IOCTL_COUNT DRM_ARRAY_SIZE( drm_ioctls ) @@ -539,14 +540,19 @@ int drm_ioctl(struct inode *inode, struct file *filp, current->pid, cmd, nr, (long)old_encode_dev(priv->head->device), priv->authenticated); - if (nr < DRIVER_IOCTL_COUNT) + if (nr >= DRIVER_IOCTL_COUNT && + (nr < DRM_COMMAND_BASE || nr >= DRM_COMMAND_END)) + goto err_i1; + if ((nr >= DRM_COMMAND_BASE) && (nr < DRM_COMMAND_END) + && (nr < DRM_COMMAND_BASE + dev->driver->num_ioctls)) + ioctl = &dev->driver->ioctls[nr - DRM_COMMAND_BASE]; + else if (nr >= DRM_COMMAND_END || nr < DRM_COMMAND_BASE) ioctl = &drm_ioctls[nr]; - else if ((nr >= DRM_COMMAND_BASE) - && (nr < DRM_COMMAND_BASE + dev->driver->num_ioctls)) - ioctl = &dev->driver->ioctls[nr - DRM_COMMAND_BASE]; - else + else goto err_i1; + + func = ioctl->func; if ((nr == DRM_IOCTL_NR(DRM_IOCTL_DMA)) && dev->driver->dma_ioctl) /* Local override? */ func = dev->driver->dma_ioctl; diff --git a/linux-core/drm_ttm.c b/linux-core/drm_ttm.c index ecf3e0ac..950b0d4d 100644 --- a/linux-core/drm_ttm.c +++ b/linux-core/drm_ttm.c @@ -850,10 +850,10 @@ int drm_ttm_object_create(drm_device_t *dev, unsigned long size, } -int drm_ttm_ioctl(drm_file_t *priv, drm_ttm_arg_t __user *data) +int drm_ttm_ioctl(DRM_IOCTL_ARGS) { + DRM_DEVICE; drm_ttm_arg_t arg; - drm_device_t *dev = priv->head->dev; drm_ttm_object_t *entry; drm_user_object_t *uo; unsigned long size; diff --git a/linux-core/drm_ttm.h b/linux-core/drm_ttm.h index bad21c97..6ebb1aa2 100644 --- a/linux-core/drm_ttm.h +++ b/linux-core/drm_ttm.h @@ -156,7 +156,7 @@ extern int drm_destroy_ttm(drm_ttm_t * ttm); extern void drm_user_destroy_region(drm_ttm_backend_list_t * entry); extern int drm_ttm_add_mm_to_list(drm_ttm_t * ttm, struct mm_struct *mm); extern void drm_ttm_delete_mm(drm_ttm_t * ttm, struct mm_struct *mm); -extern int drm_ttm_ioctl(drm_file_t *priv, drm_ttm_arg_t __user *data); +extern int drm_ttm_ioctl(DRM_IOCTL_ARGS); #define DRM_MASK_VAL(dest, mask, val) \ (dest) = ((dest) & ~(mask)) | ((val) & (mask)); |