diff options
author | Alan Hourihane <alanh@fairlite.demon.co.uk> | 2001-09-17 18:55:20 +0000 |
---|---|---|
committer | Alan Hourihane <alanh@fairlite.demon.co.uk> | 2001-09-17 18:55:20 +0000 |
commit | 861f12f19d21552c8a2f97e7aaff09809c5d0356 (patch) | |
tree | 793d43e1efe1920caed272c0e62abcbe8914cea1 /linux | |
parent | ba5415e0e2d49e34a81dc35f2c55f718ea979fdd (diff) |
more -CURRENT fixes
Diffstat (limited to 'linux')
-rw-r--r-- | linux/drm_bufs.h | 4 | ||||
-rw-r--r-- | linux/drm_drv.h | 11 | ||||
-rw-r--r-- | linux/drm_fops.h | 9 | ||||
-rw-r--r-- | linux/drm_os_linux.h | 1 | ||||
-rw-r--r-- | linux/r128_state.c | 5 |
5 files changed, 17 insertions, 13 deletions
diff --git a/linux/drm_bufs.h b/linux/drm_bufs.h index 1db5ecf4..89506e9a 100644 --- a/linux/drm_bufs.h +++ b/linux/drm_bufs.h @@ -1141,7 +1141,11 @@ int DRM(mapbufs)( DRM_OS_IOCTL ) #endif /* __linux__ */ #ifdef __FreeBSD__ vm_offset_t virtual, address; +#ifdef __FreeBSD_version >= 500000 + struct vmspace *vms = p->td_proc->p_vmspace; +#else struct vmspace *vms = p->p_vmspace; +#endif #endif /* __FreeBSD__ */ drm_buf_map_t request; int i; diff --git a/linux/drm_drv.h b/linux/drm_drv.h index acead83d..fa6b0d6e 100644 --- a/linux/drm_drv.h +++ b/linux/drm_drv.h @@ -1219,12 +1219,7 @@ int DRM(ioctl)( DRM_OS_IOCTL ) if ( !func ) { DRM_DEBUG( "no function\n" ); retcode = EINVAL; - } else if ( ( ioctl->root_only && -#ifdef __linux__ - !capable( CAP_SYS_ADMIN ) ) -#endif /* __linux__ */ -#ifdef __FreeBSD__ - suser(p) ) + } else if ( ( ioctl->root_only && DRM_OS_CHECKSUSER ) #endif /* __FreeBSD__ */ || ( ioctl->auth_needed && !priv->authenticated ) ) { retcode = EACCES; @@ -1421,7 +1416,11 @@ SYSUNINIT(DRM( unregister), SI_SUB_KLD, SI_ORDER_MIDDLE, linux_ioctl_unregister_ static int DRM(linux_ioctl)(DRM_OS_STRUCTPROC *p, struct linux_ioctl_args* args) { +#ifdef __FreeBSD_version >= 500000 + struct file *fp = p->td_proc->p_fd->fd_ofiles[args->fd]; +#else struct file *fp = p->p_fd->fd_ofiles[args->fd]; +#endif u_long cmd = args->cmd; caddr_t data = (caddr_t) args->arg; /* diff --git a/linux/drm_fops.h b/linux/drm_fops.h index c700bb71..cda5b7a0 100644 --- a/linux/drm_fops.h +++ b/linux/drm_fops.h @@ -121,18 +121,19 @@ int DRM(open_helper)(dev_t kdev, int flags, int fmt, DRM_OS_STRUCTPROC *p, } else { priv = (drm_file_t *) DRM(alloc)(sizeof(*priv), DRM_MEM_FILES); bzero(priv, sizeof(*priv)); -#if __FreeBSD_version >= 500021 - priv->uid = p->p_ucred->cr_svuid; +#if __FreeBSD_version >= 500000 + priv->uid = p->td_proc->p_ucred->cr_svuid; + priv->pid = p->td_proc->p_pid; #else priv->uid = p->p_cred->p_svuid; + priv->pid = p->p_pid; #endif - priv->pid = p->p_pid; priv->refs = 1; priv->minor = m; priv->devXX = dev; priv->ioctl_count = 0; - priv->authenticated = !suser(p); + priv->authenticated = !DRM_OS_CHECKSUSER; lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, p); TAILQ_INSERT_TAIL(&dev->files, priv, link); lockmgr(&dev->dev_lock, LK_RELEASE, 0, p); diff --git a/linux/drm_os_linux.h b/linux/drm_os_linux.h index 5022851c..0489b494 100644 --- a/linux/drm_os_linux.h +++ b/linux/drm_os_linux.h @@ -270,6 +270,7 @@ do { \ #define DRM_OS_DELAY(d) udelay(d) #define DRM_OS_RETURN(v) return -v; #define DRM_OS_CURRENTPID current->pid +#define DRM_OS_CHECKSUSER !capable( CAP_SYS_ADMIN ) #define DRM_OS_KRNTOUSR(arg1, arg2, arg3) \ if ( copy_to_user(arg1, &arg2, arg3) ) \ return -EFAULT diff --git a/linux/r128_state.c b/linux/r128_state.c index 54ff72d9..23840cde 100644 --- a/linux/r128_state.c +++ b/linux/r128_state.c @@ -1517,9 +1517,8 @@ int r128_cce_indirect( DRM_OS_IOCTL ) return -EINVAL; } - if ( copy_from_user( &indirect, (drm_r128_indirect_t *)arg, - sizeof(indirect) ) ) - return -EFAULT; + DRM_OS_KRNFROMUSR( indirect, (drm_r128_indirect_t *) arg, + sizeof(indirect) ); DRM_DEBUG( "indirect: idx=%d s=%d e=%d d=%d\n", indirect.idx, indirect.start, |