summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepa Dinamani <deepa.kernel@gmail.com>2019-02-02 10:34:48 -0500
committerDavid S. Miller <davem@davemloft.net>2019-02-03 14:17:30 -0500
commit13c6ee2a921683bae4bb4ba57b1f5b82f49e6b8a (patch)
tree6603af04975126384041dacb4d094d58e6de7b6b
parentbcb3fc3247e5a7ceb467ca0cfdaa4c1b830dd8f9 (diff)
socket: Use old_timeval types for socket timestamps
As part of y2038 solution, all internal uses of struct timeval are replaced by struct __kernel_old_timeval and struct compat_timeval by struct old_timeval32. Make socket timestamps use these new types. This is mainly to be able to verify that the kernel build is y2038 safe when such non y2038 safe types are not supported anymore. Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com> Acked-by: Willem de Bruijn <willemb@google.com> Cc: isdn@linux-pingi.de Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/isdn/mISDN/socket.c2
-rw-r--r--include/linux/skbuff.h6
-rw-r--r--net/bluetooth/hci_sock.c4
-rw-r--r--net/compat.c6
-rw-r--r--net/ipv4/tcp.c2
-rw-r--r--net/rds/recv.c2
-rw-r--r--net/socket.c2
7 files changed, 12 insertions, 12 deletions
diff --git a/drivers/isdn/mISDN/socket.c b/drivers/isdn/mISDN/socket.c
index 15d3ca37669a..4ab8b1b6608f 100644
--- a/drivers/isdn/mISDN/socket.c
+++ b/drivers/isdn/mISDN/socket.c
@@ -103,7 +103,7 @@ mISDN_ctrl(struct mISDNchannel *ch, u_int cmd, void *arg)
103static inline void 103static inline void
104mISDN_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_buff *skb) 104mISDN_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_buff *skb)
105{ 105{
106 struct timeval tv; 106 struct __kernel_old_timeval tv;
107 107
108 if (_pms(sk)->cmask & MISDN_TIME_STAMP) { 108 if (_pms(sk)->cmask & MISDN_TIME_STAMP) {
109 skb_get_timestamp(skb, &tv); 109 skb_get_timestamp(skb, &tv);
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index c34595374e93..4001611a4c9f 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -3486,16 +3486,16 @@ static inline ktime_t skb_get_ktime(const struct sk_buff *skb)
3486/** 3486/**
3487 * skb_get_timestamp - get timestamp from a skb 3487 * skb_get_timestamp - get timestamp from a skb
3488 * @skb: skb to get stamp from 3488 * @skb: skb to get stamp from
3489 * @stamp: pointer to struct timeval to store stamp in 3489 * @stamp: pointer to struct __kernel_old_timeval to store stamp in
3490 * 3490 *
3491 * Timestamps are stored in the skb as offsets to a base timestamp. 3491 * Timestamps are stored in the skb as offsets to a base timestamp.
3492 * This function converts the offset back to a struct timeval and stores 3492 * This function converts the offset back to a struct timeval and stores
3493 * it in stamp. 3493 * it in stamp.
3494 */ 3494 */
3495static inline void skb_get_timestamp(const struct sk_buff *skb, 3495static inline void skb_get_timestamp(const struct sk_buff *skb,
3496 struct timeval *stamp) 3496 struct __kernel_old_timeval *stamp)
3497{ 3497{
3498 *stamp = ktime_to_timeval(skb->tstamp); 3498 *stamp = ns_to_kernel_old_timeval(skb->tstamp);
3499} 3499}
3500 3500
3501static inline void skb_get_timestampns(const struct sk_buff *skb, 3501static inline void skb_get_timestampns(const struct sk_buff *skb,
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index 1506e1632394..65228bfa4487 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -1383,9 +1383,9 @@ static void hci_sock_cmsg(struct sock *sk, struct msghdr *msg,
1383 1383
1384 if (mask & HCI_CMSG_TSTAMP) { 1384 if (mask & HCI_CMSG_TSTAMP) {
1385#ifdef CONFIG_COMPAT 1385#ifdef CONFIG_COMPAT
1386 struct compat_timeval ctv; 1386 struct old_timeval32 ctv;
1387#endif 1387#endif
1388 struct timeval tv; 1388 struct __kernel_old_timeval tv;
1389 void *data; 1389 void *data;
1390 int len; 1390 int len;
1391 1391
diff --git a/net/compat.c b/net/compat.c
index ccf93cd0e49b..9629f053d4fa 100644
--- a/net/compat.c
+++ b/net/compat.c
@@ -209,8 +209,8 @@ int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *dat
209{ 209{
210 struct compat_cmsghdr __user *cm = (struct compat_cmsghdr __user *) kmsg->msg_control; 210 struct compat_cmsghdr __user *cm = (struct compat_cmsghdr __user *) kmsg->msg_control;
211 struct compat_cmsghdr cmhdr; 211 struct compat_cmsghdr cmhdr;
212 struct compat_timeval ctv; 212 struct old_timeval32 ctv;
213 struct compat_timespec cts[3]; 213 struct old_timespec32 cts[3];
214 int cmlen; 214 int cmlen;
215 215
216 if (cm == NULL || kmsg->msg_controllen < sizeof(*cm)) { 216 if (cm == NULL || kmsg->msg_controllen < sizeof(*cm)) {
@@ -220,7 +220,7 @@ int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *dat
220 220
221 if (!COMPAT_USE_64BIT_TIME) { 221 if (!COMPAT_USE_64BIT_TIME) {
222 if (level == SOL_SOCKET && type == SO_TIMESTAMP_OLD) { 222 if (level == SOL_SOCKET && type == SO_TIMESTAMP_OLD) {
223 struct timeval *tv = (struct timeval *)data; 223 struct __kernel_old_timeval *tv = (struct __kernel_old_timeval *)data;
224 ctv.tv_sec = tv->tv_sec; 224 ctv.tv_sec = tv->tv_sec;
225 ctv.tv_usec = tv->tv_usec; 225 ctv.tv_usec = tv->tv_usec;
226 data = &ctv; 226 data = &ctv;
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index e29aec59cad1..3ce41b04c0f0 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1861,7 +1861,7 @@ static void tcp_update_recv_tstamps(struct sk_buff *skb,
1861static void tcp_recv_timestamp(struct msghdr *msg, const struct sock *sk, 1861static void tcp_recv_timestamp(struct msghdr *msg, const struct sock *sk,
1862 struct scm_timestamping *tss) 1862 struct scm_timestamping *tss)
1863{ 1863{
1864 struct timeval tv; 1864 struct __kernel_old_timeval tv;
1865 bool has_timestamping = false; 1865 bool has_timestamping = false;
1866 1866
1867 if (tss->ts[0].tv_sec || tss->ts[0].tv_nsec) { 1867 if (tss->ts[0].tv_sec || tss->ts[0].tv_nsec) {
diff --git a/net/rds/recv.c b/net/rds/recv.c
index 04e30d63a159..435bf2320cd3 100644
--- a/net/rds/recv.c
+++ b/net/rds/recv.c
@@ -549,7 +549,7 @@ static int rds_cmsg_recv(struct rds_incoming *inc, struct msghdr *msg,
549 549
550 if ((inc->i_rx_tstamp != 0) && 550 if ((inc->i_rx_tstamp != 0) &&
551 sock_flag(rds_rs_to_sk(rs), SOCK_RCVTSTAMP)) { 551 sock_flag(rds_rs_to_sk(rs), SOCK_RCVTSTAMP)) {
552 struct timeval tv = ktime_to_timeval(inc->i_rx_tstamp); 552 struct __kernel_old_timeval tv = ns_to_kernel_old_timeval(inc->i_rx_tstamp);
553 ret = put_cmsg(msg, SOL_SOCKET, SO_TIMESTAMP_OLD, 553 ret = put_cmsg(msg, SOL_SOCKET, SO_TIMESTAMP_OLD,
554 sizeof(tv), &tv); 554 sizeof(tv), &tv);
555 if (ret) 555 if (ret)
diff --git a/net/socket.c b/net/socket.c
index 5087f9e40f3a..9cc281cdb9d9 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -719,7 +719,7 @@ void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
719 719
720 if (need_software_tstamp) { 720 if (need_software_tstamp) {
721 if (!sock_flag(sk, SOCK_RCVTSTAMPNS)) { 721 if (!sock_flag(sk, SOCK_RCVTSTAMPNS)) {
722 struct timeval tv; 722 struct __kernel_old_timeval tv;
723 skb_get_timestamp(skb, &tv); 723 skb_get_timestamp(skb, &tv);
724 put_cmsg(msg, SOL_SOCKET, SO_TIMESTAMP_OLD, 724 put_cmsg(msg, SOL_SOCKET, SO_TIMESTAMP_OLD,
725 sizeof(tv), &tv); 725 sizeof(tv), &tv);