From 26ca0bca9bd5e23b1d31bc6dfb6d58b62143447b Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Tue, 27 Jan 2009 22:39:50 +0200 Subject: drm compat: fix euid for >=2.6.28 drm_fops.c reads the current process' EUID directly from task_struct. Apparently starting in 2.6.28-rc4 this fails to build. In Linus' tree, commit b6dff3ec5e116e3af6f537d4caedcad6b9e5082a "CRED: Separate task security context from task_struct" moves the euid field from task_struct to another struct. Earlier commit 9e2b2dc4133f65272a6d3c5dcb2ce63f8a87cae9 "CRED: Introduce credential access wrappers" implements the wrapper macros to access e.g. euid. This is in 2.6.27-rc4, and this contains the definition of current_euid() that will be used in the DRM compatibility header for kernels before 2.6.27. That commit also creates , which contains the upstream definition of current_euid(). drm_fops.c is fixed to use current_euid(), and drm_compat.h will offer the compatibility definition for kernels <2.6.27. Signed-off-by: Pekka Paalanen --- linux-core/drm_compat.h | 6 ++++++ linux-core/drm_fops.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'linux-core') diff --git a/linux-core/drm_compat.h b/linux-core/drm_compat.h index bc4d2e58..4ae4ba6d 100644 --- a/linux-core/drm_compat.h +++ b/linux-core/drm_compat.h @@ -56,6 +56,12 @@ #define module_param(name, type, perm) #endif +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)) +#define current_euid() (current->euid) +#else +#include +#endif + /* older kernels had different irq args */ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) #undef DRM_IRQ_ARGS diff --git a/linux-core/drm_fops.c b/linux-core/drm_fops.c index ec521101..837645ae 100644 --- a/linux-core/drm_fops.c +++ b/linux-core/drm_fops.c @@ -250,7 +250,7 @@ static int drm_open_helper(struct inode *inode, struct file *filp, memset(priv, 0, sizeof(*priv)); filp->private_data = priv; priv->filp = filp; - priv->uid = current->euid; + priv->uid = current_euid(); priv->pid = current->pid; priv->minor = idr_find(&drm_minors_idr, minor_id); priv->ioctl_count = 0; -- cgit v1.2.3