diff options
author | Linus Torvalds <torvalds@athlon.transmeta.com> | 2002-02-04 18:16:28 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@athlon.transmeta.com> | 2002-02-04 18:16:28 -0800 |
commit | 923215ae27c66dc2d25cc93ce1f7d3ef821c80bc (patch) | |
tree | 8e0f3e6a424096be83ba1af0a5c7bd117a9c649f /ipc | |
parent | 02947070b658af5e0d8abdc7ad8486423a143553 (diff) | |
download | history-923215ae27c66dc2d25cc93ce1f7d3ef821c80bc.tar.gz |
v2.4.4.3 -> v2.4.4.4
- Russell King: ARM updates
- Al Viro: more init cleanups
- Cort Dougan: more PPC updates
- David Miller: cleanups, pci mmap updates
- Neil Brown: raid resync by sector
- Alan Cox: more merging with -ac
- Johannes Erdfelt: USB updates
- Kai Germaschewski: ISDN updates
- Tobias Ringstrom: dmfe.c network driver update
- Trond Myklebust: NFS client updates and cleanups
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/shm.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/ipc/shm.c b/ipc/shm.c index c4af6517d9a4e3..76602a8649ff74 100644 --- a/ipc/shm.c +++ b/ipc/shm.c @@ -497,14 +497,21 @@ asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds *buf) if (shp == NULL) goto out_up; err = shm_checkid(shp, shmid); - if (err == 0) { - if (shp->shm_nattch){ - shp->shm_flags |= SHM_DEST; - /* Do not find it any more */ - shp->shm_perm.key = IPC_PRIVATE; - } else - shm_destroy (shp); + if(err) + goto out_unlock_up; + if (current->euid != shp->shm_perm.uid && + current->euid != shp->shm_perm.cuid && + !capable(CAP_SYS_ADMIN)) { + err=-EPERM; + goto out_unlock_up; } + if (shp->shm_nattch){ + shp->shm_flags |= SHM_DEST; + /* Do not find it any more */ + shp->shm_perm.key = IPC_PRIVATE; + } else + shm_destroy (shp); + /* Unlock */ shm_unlock(shmid); up(&shm_ids.sem); |