Commit dffb6acd authored by Anton Blanchard's avatar Anton Blanchard

[PATCH] fix compat_sys_getrusage

compat_sys_getrusage was returning the result of a logical or. Make
it return the result of sys_getrusage if it fails or -EFAULT if we
cant write it out to userspace.
parent 7015b1a3
...@@ -344,12 +344,16 @@ asmlinkage long compat_sys_getrusage(int who, struct compat_rusage *ru) ...@@ -344,12 +344,16 @@ asmlinkage long compat_sys_getrusage(int who, struct compat_rusage *ru)
struct rusage r; struct rusage r;
int ret; int ret;
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
ret = sys_getrusage(who, &r); ret = sys_getrusage(who, &r);
set_fs(old_fs); set_fs(old_fs);
return ret || put_compat_rusage(ru, &r); if (ret)
return ret;
if (put_compat_rusage(ru, &r))
return -EFAULT;
} }
asmlinkage long asmlinkage long
......
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