Commit 644595f8 authored by H. Peter Anvin's avatar H. Peter Anvin

compat: Handle COMPAT_USE_64BIT_TIME in net/socket.c

Use helper functions aware of COMPAT_USE_64BIT_TIME to write struct
timeval and struct timespec to userspace in net/socket.c.
Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
parent ee4fa23c
...@@ -2600,7 +2600,7 @@ void socket_seq_show(struct seq_file *seq) ...@@ -2600,7 +2600,7 @@ void socket_seq_show(struct seq_file *seq)
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
static int do_siocgstamp(struct net *net, struct socket *sock, static int do_siocgstamp(struct net *net, struct socket *sock,
unsigned int cmd, struct compat_timeval __user *up) unsigned int cmd, void __user *up)
{ {
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
struct timeval ktv; struct timeval ktv;
...@@ -2609,15 +2609,14 @@ static int do_siocgstamp(struct net *net, struct socket *sock, ...@@ -2609,15 +2609,14 @@ static int do_siocgstamp(struct net *net, struct socket *sock,
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
err = sock_do_ioctl(net, sock, cmd, (unsigned long)&ktv); err = sock_do_ioctl(net, sock, cmd, (unsigned long)&ktv);
set_fs(old_fs); set_fs(old_fs);
if (!err) { if (!err)
err = put_user(ktv.tv_sec, &up->tv_sec); err = compat_put_timeval(up, &ktv);
err |= __put_user(ktv.tv_usec, &up->tv_usec);
}
return err; return err;
} }
static int do_siocgstampns(struct net *net, struct socket *sock, static int do_siocgstampns(struct net *net, struct socket *sock,
unsigned int cmd, struct compat_timespec __user *up) unsigned int cmd, void __user *up)
{ {
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
struct timespec kts; struct timespec kts;
...@@ -2626,10 +2625,9 @@ static int do_siocgstampns(struct net *net, struct socket *sock, ...@@ -2626,10 +2625,9 @@ static int do_siocgstampns(struct net *net, struct socket *sock,
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
err = sock_do_ioctl(net, sock, cmd, (unsigned long)&kts); err = sock_do_ioctl(net, sock, cmd, (unsigned long)&kts);
set_fs(old_fs); set_fs(old_fs);
if (!err) { if (!err)
err = put_user(kts.tv_sec, &up->tv_sec); err = compat_put_timespec(up, &kts);
err |= __put_user(kts.tv_nsec, &up->tv_nsec);
}
return err; return err;
} }
......
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