aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2012-02-19 20:51:59 -0500
committerH. Peter Anvin <hpa@zytor.com>2012-02-20 15:48:48 -0500
commit644595f89620ba8446cc555be336d24a34464950 (patch)
treec5d1533e9ba7f7347c50ff9351763364c2fe6282 /net
parentee4fa23c4bfcc635d077a9633d405610de45bc70 (diff)
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: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'net')
-rw-r--r--net/socket.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/net/socket.c b/net/socket.c
index 28a96af484b4..5325d4c797c9 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2600,7 +2600,7 @@ void socket_seq_show(struct seq_file *seq)
2600 2600
2601#ifdef CONFIG_COMPAT 2601#ifdef CONFIG_COMPAT
2602static int do_siocgstamp(struct net *net, struct socket *sock, 2602static int do_siocgstamp(struct net *net, struct socket *sock,
2603 unsigned int cmd, struct compat_timeval __user *up) 2603 unsigned int cmd, void __user *up)
2604{ 2604{
2605 mm_segment_t old_fs = get_fs(); 2605 mm_segment_t old_fs = get_fs();
2606 struct timeval ktv; 2606 struct timeval ktv;
@@ -2609,15 +2609,14 @@ static int do_siocgstamp(struct net *net, struct socket *sock,
2609 set_fs(KERNEL_DS); 2609 set_fs(KERNEL_DS);
2610 err = sock_do_ioctl(net, sock, cmd, (unsigned long)&ktv); 2610 err = sock_do_ioctl(net, sock, cmd, (unsigned long)&ktv);
2611 set_fs(old_fs); 2611 set_fs(old_fs);
2612 if (!err) { 2612 if (!err)
2613 err = put_user(ktv.tv_sec, &up->tv_sec); 2613 err = compat_put_timeval(up, &ktv);
2614 err |= __put_user(ktv.tv_usec, &up->tv_usec); 2614
2615 }
2616 return err; 2615 return err;
2617} 2616}
2618 2617
2619static int do_siocgstampns(struct net *net, struct socket *sock, 2618static int do_siocgstampns(struct net *net, struct socket *sock,
2620 unsigned int cmd, struct compat_timespec __user *up) 2619 unsigned int cmd, void __user *up)
2621{ 2620{
2622 mm_segment_t old_fs = get_fs(); 2621 mm_segment_t old_fs = get_fs();
2623 struct timespec kts; 2622 struct timespec kts;
@@ -2626,10 +2625,9 @@ static int do_siocgstampns(struct net *net, struct socket *sock,
2626 set_fs(KERNEL_DS); 2625 set_fs(KERNEL_DS);
2627 err = sock_do_ioctl(net, sock, cmd, (unsigned long)&kts); 2626 err = sock_do_ioctl(net, sock, cmd, (unsigned long)&kts);
2628 set_fs(old_fs); 2627 set_fs(old_fs);
2629 if (!err) { 2628 if (!err)
2630 err = put_user(kts.tv_sec, &up->tv_sec); 2629 err = compat_put_timespec(up, &kts);
2631 err |= __put_user(kts.tv_nsec, &up->tv_nsec); 2630
2632 }
2633 return err; 2631 return err;
2634} 2632}
2635 2633