Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=50157b09b33c2ec3637d3b317b06a7235c57c7f2
Commit:     50157b09b33c2ec3637d3b317b06a7235c57c7f2
Parent:     a27e5a13d5863bb9de0ac80cb4bb3f4442f0aad1
Author:     Alexandr Andreev <[EMAIL PROTECTED]>
AuthorDate: Tue Mar 6 02:34:24 2007 -0800
Committer:  Tony Luck <[EMAIL PROTECTED]>
CommitDate: Tue Mar 6 14:49:24 2007 -0800

    [IA64] sync compat getdents
    
    Add VERIFY_WRITE check in the beginning like compat_sys_getdents() (EINVAL 
vs
    EFAULT).
    
    Signed-off-by: Alexandr Andreev <[EMAIL PROTECTED]>
    Signed-off-by: Alexey Dobriyan <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Tony Luck <[EMAIL PROTECTED]>
---
 arch/ia64/ia32/sys_ia32.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
index d430d36..0afb4fe 100644
--- a/arch/ia64/ia32/sys_ia32.c
+++ b/arch/ia64/ia32/sys_ia32.c
@@ -1267,6 +1267,10 @@ sys32_getdents (unsigned int fd, struct compat_dirent 
__user *dirent, unsigned i
        struct getdents32_callback buf;
        int error;
 
+       error = -EFAULT;
+       if (!access_ok(VERIFY_WRITE, dirent, count))
+               goto out;
+
        error = -EBADF;
        file = fget(fd);
        if (!file)
@@ -1283,10 +1287,10 @@ sys32_getdents (unsigned int fd, struct compat_dirent 
__user *dirent, unsigned i
        error = buf.error;
        lastdirent = buf.previous;
        if (lastdirent) {
-               error = -EINVAL;
                if (put_user(file->f_pos, &lastdirent->d_off))
-                       goto out_putf;
-               error = count - buf.count;
+                       error = -EFAULT;
+               else
+                       error = count - buf.count;
        }
 
 out_putf:
-
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