diff options
Diffstat (limited to 'net/bluetooth/hci_sock.c')
-rw-r--r-- | net/bluetooth/hci_sock.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 1dae3dfc66a9..68198a788969 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/skbuff.h> | 37 | #include <linux/skbuff.h> |
38 | #include <linux/workqueue.h> | 38 | #include <linux/workqueue.h> |
39 | #include <linux/interrupt.h> | 39 | #include <linux/interrupt.h> |
40 | #include <linux/compat.h> | ||
40 | #include <linux/socket.h> | 41 | #include <linux/socket.h> |
41 | #include <linux/ioctl.h> | 42 | #include <linux/ioctl.h> |
42 | #include <net/sock.h> | 43 | #include <net/sock.h> |
@@ -342,9 +343,23 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_ | |||
342 | 343 | ||
343 | if (mask & HCI_CMSG_TSTAMP) { | 344 | if (mask & HCI_CMSG_TSTAMP) { |
344 | struct timeval tv; | 345 | struct timeval tv; |
346 | void *data; | ||
347 | int len; | ||
345 | 348 | ||
346 | skb_get_timestamp(skb, &tv); | 349 | skb_get_timestamp(skb, &tv); |
347 | put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, sizeof(tv), &tv); | 350 | |
351 | if (msg->msg_flags & MSG_CMSG_COMPAT) { | ||
352 | struct compat_timeval ctv; | ||
353 | ctv.tv_sec = tv.tv_sec; | ||
354 | ctv.tv_usec = tv.tv_usec; | ||
355 | data = &ctv; | ||
356 | len = sizeof(ctv); | ||
357 | } else { | ||
358 | data = &tv; | ||
359 | len = sizeof(tv); | ||
360 | } | ||
361 | |||
362 | put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, len, data); | ||
348 | } | 363 | } |
349 | } | 364 | } |
350 | 365 | ||