Skip to content

Commit

Permalink
drm: only trust core drm ioctls - driver ioctls are a mess.
Browse files Browse the repository at this point in the history
So driver ioctls need a full auditing before we can make this change.

Signed-off-by: Dave Airlie <airlied@redhat.com>
  • Loading branch information
airlied committed Jun 20, 2008
1 parent d3adbc0 commit 858a368
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions drivers/char/drm/drm_drv.c
Expand Up @@ -470,19 +470,18 @@ int drm_ioctl(struct inode *inode, struct file *filp,
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))
else if ((nr >= DRM_COMMAND_END) || (nr < DRM_COMMAND_BASE)) {
ioctl = &drm_ioctls[nr];
else
cmd = ioctl->cmd;
} else
goto err_i1;

/* Do not trust userspace, use our own definition */
cmd = ioctl->cmd;
func = ioctl->func;
/* is there a local override? */
if ((nr == DRM_IOCTL_NR(DRM_IOCTL_DMA)) && dev->driver->dma_ioctl)
func = dev->driver->dma_ioctl;


if (!func) {
DRM_DEBUG("no function\n");
retcode = -EINVAL;
Expand Down

0 comments on commit 858a368

Please sign in to comment.