Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1ae7075bcd805c3aa5e8f53effc63a4562d6110e
Commit:     1ae7075bcd805c3aa5e8f53effc63a4562d6110e
Parent:     7b8e89249ba54fb6e12358bbed7e3070fa1d1e6a
Author:     Chris Snook <[EMAIL PROTECTED]>
AuthorDate: Tue May 8 00:24:15 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Tue May 8 11:14:59 2007 -0700

    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 <[EMAIL PROTECTED]>
    Acked-by: David Howells <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 fs/read_write.c    |    4 ++--
 include/linux/fs.h |    1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/read_write.c b/fs/read_write.c
index 0642a16..4d03008 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,
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 020a842..986b5d5 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -30,6 +30,7 @@
 #define SEEK_SET       0       /* seek relative to beginning of file */
 #define SEEK_CUR       1       /* seek relative to current file position */
 #define SEEK_END       2       /* seek relative to end of file */
+#define SEEK_MAX       SEEK_END
 
 /* And dynamically-tunable limits and defaults: */
 struct files_stat_struct {
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to