summaryrefslogtreecommitdiffstats
path: root/fs/fcntl.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2010-03-05 13:42:42 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-06 11:26:29 -0800
commitd554ed895dc8f293cc712c71f14b101ace82579a (patch)
treefd29ba33d640e156e2ca4267ffbdb9dc566fd3d6 /fs/fcntl.c
parent221e3ebf6d5f2625373573155924e39f196c5d3d (diff)
downloadlinux-d554ed895dc8f293cc712c71f14b101ace82579a.tar.gz
linux-d554ed895dc8f293cc712c71f14b101ace82579a.tar.bz2
linux-d554ed895dc8f293cc712c71f14b101ace82579a.zip
fs: 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 commit 3e10e716abf3 ("resource: add helpers for fetching rlimits") or ACCESS_ONCE if not applicable. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/fcntl.c')
-rw-r--r--fs/fcntl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/fcntl.c b/fs/fcntl.c
index 97e01dc0d95f..452d02f9075e 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -344,7 +344,7 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,
switch (cmd) {
case F_DUPFD:
case F_DUPFD_CLOEXEC:
- if (arg >= current->signal->rlim[RLIMIT_NOFILE].rlim_cur)
+ if (arg >= rlimit(RLIMIT_NOFILE))
break;
err = alloc_fd(arg, cmd == F_DUPFD_CLOEXEC ? O_CLOEXEC : 0);
if (err >= 0) {