patch-2.1.72 linux/ipc/shm.c

Next file: linux/ipc/util.c
Previous file: linux/ipc/sem.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.71/linux/ipc/shm.c linux/ipc/shm.c
@@ -346,8 +346,8 @@
 		copy_to_user (buf, &tbuf, sizeof(*buf));
 		break;
 	case IPC_SET:
-		if (suser() || current->euid == shp->shm_perm.uid ||
-		    current->euid == shp->shm_perm.cuid) {
+		if (current->euid == shp->shm_perm.uid ||
+		    current->euid == shp->shm_perm.cuid || suser()) {
 			ipcp->uid = tbuf.shm_perm.uid;
 			ipcp->gid = tbuf.shm_perm.gid;
 			ipcp->mode = (ipcp->mode & ~S_IRWXUGO)
@@ -358,8 +358,8 @@
 		err = -EPERM;
 		goto out;
 	case IPC_RMID:
-		if (suser() || current->euid == shp->shm_perm.uid ||
-		    current->euid == shp->shm_perm.cuid) {
+		if (current->euid == shp->shm_perm.uid ||
+		    current->euid == shp->shm_perm.cuid || suser()) {
 			shp->shm_perm.mode |= SHM_DEST;
 			if (shp->shm_nattch <= 0)
 				killseg (id);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov