Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2c8307f63dd5caaf7ff8ad5118951e559a9ed5c8
Commit:     2c8307f63dd5caaf7ff8ad5118951e559a9ed5c8
Parent:     01da41b86f6e5f9a724e20a63f093d77e37d8056
Author:     Alexandr Andreev <[EMAIL PROTECTED]>
AuthorDate: Tue Mar 6 02:44:13 2007 -0800
Committer:  Kyle McMartin <[EMAIL PROTECTED]>
CommitDate: Tue May 22 22:42:56 2007 -0400

    parisc: sync compat getdents
    
    Add VERIFY_WRITE check in the beginning like compat_sys_getdents() EFAULT on
    parisc if put_user() fails.
    
    Signed-off-by: Alexandr Andreev <[EMAIL PROTECTED]>
    Signed-off-by: Alexey Dobriyan <[EMAIL PROTECTED]>
    Cc: Kyle McMartin <[EMAIL PROTECTED]>
    Cc: Matthew Wilcox <[EMAIL PROTECTED]>
    Cc: Grant Grundler <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Kyle McMartin <[EMAIL PROTECTED]>
---
 arch/parisc/kernel/sys_parisc32.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/parisc/kernel/sys_parisc32.c 
b/arch/parisc/kernel/sys_parisc32.c
index ce3245f..a8ebac4 100644
--- a/arch/parisc/kernel/sys_parisc32.c
+++ b/arch/parisc/kernel/sys_parisc32.c
@@ -350,6 +350,10 @@ sys32_getdents (unsigned int fd, void __user * dirent, 
unsigned int count)
        struct getdents32_callback buf;
        int error;
 
+       error = -EFAULT;
+       if (!access_ok(VERIFY_WRITE, dirent, count))
+               goto out;
+
        error = -EBADF;
        file = fget(fd);
        if (!file)
@@ -366,8 +370,10 @@ sys32_getdents (unsigned int fd, void __user * dirent, 
unsigned int count)
        error = buf.error;
        lastdirent = buf.previous;
        if (lastdirent) {
-               put_user(file->f_pos, &lastdirent->d_off);
-               error = count - buf.count;
+               if (put_user(file->f_pos, &lastdirent->d_off))
+                       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