Commit 83b942bd authored by Tsuneo.Yoshioka@f-secure.com's avatar Tsuneo.Yoshioka@f-secure.com Committed by Linus Torvalds

[PATCH] x86-64: Fix 32bit sendfile

If we use 64bit kernel on ia64/x86_64/s390 architecture, and we run
32bit binary on 32bit compatibility mode, sendfile system call seems be
not set offset argument.

This is because sendfile's return value is not zero but the code regards
the result by return value is zero or not.

This problem will be affect to ia64/x86_64/s390 and not affect to other
architecture does not affect other architecture (mips/parisc/ppc64/sparc64).
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 9acf23c4
...@@ -2327,7 +2327,7 @@ sys32_sendfile (int out_fd, int in_fd, int __user *offset, unsigned int count) ...@@ -2327,7 +2327,7 @@ sys32_sendfile (int out_fd, int in_fd, int __user *offset, unsigned int count)
ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *) &of : NULL, count); ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *) &of : NULL, count);
set_fs(old_fs); set_fs(old_fs);
if (!ret && offset && put_user(of, offset)) if (offset && put_user(of, offset))
return -EFAULT; return -EFAULT;
return ret; return ret;
......
...@@ -678,7 +678,7 @@ asmlinkage long sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, size ...@@ -678,7 +678,7 @@ asmlinkage long sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, size
ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count); ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count);
set_fs(old_fs); set_fs(old_fs);
if (!ret && offset && put_user(of, offset)) if (offset && put_user(of, offset))
return -EFAULT; return -EFAULT;
return ret; return ret;
......
...@@ -751,7 +751,7 @@ sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count) ...@@ -751,7 +751,7 @@ sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count)
ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count); ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count);
set_fs(old_fs); set_fs(old_fs);
if (!ret && offset && put_user(of, offset)) if (offset && put_user(of, offset))
return -EFAULT; return -EFAULT;
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment