aboutsummaryrefslogtreecommitdiffstats
path: root/ipc/shm.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2010-03-10 18:23:05 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-12 18:52:39 -0500
commitf1eb1332b8f07e937add24c6fd2ac40b8737a2f4 (patch)
tree43bfaac596ae20dcab088b870406e58a2bb4b78a /ipc/shm.c
parentd6db2ade10852b7c665b361239c3411abaa880b5 (diff)
ipc: use rlimit helpers
Make sure compiler won't do weird things with limits. E.g. fetching them twice may return 2 different values after writable limits are implemented. I.e. either use rlimit helpers added in 3e10e716abf3c71bdb5d86b8f507f9e72236c9cd ("resource: add helpers for fetching rlimits") or ACCESS_ONCE if not applicable. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'ipc/shm.c')
-rw-r--r--ipc/shm.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/ipc/shm.c b/ipc/shm.c
index 23256b855819..1a314c89f93c 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -764,8 +764,7 @@ SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, struct shmid_ds __user *, buf)
764 if (euid != shp->shm_perm.uid && 764 if (euid != shp->shm_perm.uid &&
765 euid != shp->shm_perm.cuid) 765 euid != shp->shm_perm.cuid)
766 goto out_unlock; 766 goto out_unlock;
767 if (cmd == SHM_LOCK && 767 if (cmd == SHM_LOCK && !rlimit(RLIMIT_MEMLOCK))
768 !current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur)
769 goto out_unlock; 768 goto out_unlock;
770 } 769 }
771 770