]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - ipc/shm.c
CRED: Wrap task credential accesses in the SYSV IPC subsystem
[linux-2.6-omap-h63xx.git] / ipc / shm.c
index 867e5d6a55c23ec64361db7e9eb2e1cf93b4f559..0c3debbe32d5a05f4e14815b98de2b58871b9ece 100644 (file)
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -752,9 +752,10 @@ asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf)
                        goto out_unlock;
 
                if (!capable(CAP_IPC_LOCK)) {
+                       uid_t euid = current_euid();
                        err = -EPERM;
-                       if (current->euid != shp->shm_perm.uid &&
-                           current->euid != shp->shm_perm.cuid)
+                       if (euid != shp->shm_perm.uid &&
+                           euid != shp->shm_perm.cuid)
                                goto out_unlock;
                        if (cmd == SHM_LOCK &&
                            !current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur)