summaryrefslogtreecommitdiff
path: root/fs/read_write.c
diff options
context:
space:
mode:
authorChris Snook <csnook@redhat.com>2007-05-08 11:24:15 +0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 22:14:59 +0400
commit1ae7075bcd805c3aa5e8f53effc63a4562d6110e (patch)
tree76ce9da136deee264b1642169522981b5175af82 /fs/read_write.c
parent7b8e89249ba54fb6e12358bbed7e3070fa1d1e6a (diff)
downloadlinux-1ae7075bcd805c3aa5e8f53effc63a4562d6110e.tar.xz
use use SEEK_MAX to validate user lseek arguments
Add SEEK_MAX and use it to validate lseek arguments from userspace. Signed-off-by: Chris Snook <csnook@redhat.com> Acked-by: David Howells <dhowells@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/read_write.c')
-rw-r--r--fs/read_write.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/read_write.c b/fs/read_write.c
index 0642a1691d15..4d03008f015b 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -139,7 +139,7 @@ asmlinkage off_t sys_lseek(unsigned int fd, off_t offset, unsigned int origin)
goto bad;
retval = -EINVAL;
- if (origin <= 2) {
+ if (origin <= SEEK_MAX) {
loff_t res = vfs_llseek(file, offset, origin);
retval = res;
if (res != (loff_t)retval)
@@ -166,7 +166,7 @@ asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high,
goto bad;
retval = -EINVAL;
- if (origin > 2)
+ if (origin > SEEK_MAX)
goto out_putf;
offset = vfs_llseek(file, ((loff_t) offset_high << 32) | offset_low,