Skip to content

Commit f3926e4

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull misc uaccess fixes from Al Viro: "Fix for unsafe_put_user() (no callers currently in mainline, but anyone starting to use it will step into that) + alpha osf_wait4() infoleak fix" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: osf_wait4(): fix infoleak fix unsafe_put_user()
2 parents 970c305 + a8c3954 commit f3926e4

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

arch/alpha/kernel/osf_sys.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,8 +1201,10 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options,
12011201
if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur)))
12021202
return -EFAULT;
12031203

1204-
err = 0;
1205-
err |= put_user(status, ustatus);
1204+
err = put_user(status, ustatus);
1205+
if (ret < 0)
1206+
return err ? err : ret;
1207+
12061208
err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec);
12071209
err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec);
12081210
err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);

arch/x86/include/asm/uaccess.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ extern struct movsl_mask {
703703
#define unsafe_put_user(x, ptr, err_label) \
704704
do { \
705705
int __pu_err; \
706-
__put_user_size((x), (ptr), sizeof(*(ptr)), __pu_err, -EFAULT); \
706+
__put_user_size((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)), __pu_err, -EFAULT); \
707707
if (unlikely(__pu_err)) goto err_label; \
708708
} while (0)
709709

0 commit comments

Comments
 (0)