hci_sock.c build failure
Hello,
I'm wondering why the build failure wasn't fixed by a patch like this:
net/bluetooth/hci_sock.c +3 -2
@@ -348,8 +348,6 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_skb_get_timestamp (skb, &tv); - data = &tv; - len =sizeof (tv);#ifdef CONFIG_COMPAT if (msg->msg_flags &MSG_CMSG_COMPAT ) {struct compat_timeval ctv;
@@ -358,6 +356,9 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_ data = &ctv; len = sizeof(ctv); } +#else + data = &tv; + len =sizeof (tv);#endif put_cmsg (msg,SOL_HCI ,HCI_CMSG_TSTAMP , len, data);
Signature · 4 lines
MfG/Sincerely Toralf Förster pgp finger print: 7B1A 07F4 EC82 0F90 D4C2 8936 872A E508 7DB6 9DA3
Marcel Holtmann
maintainerHi Toralf,
Quoted 17 lines
I'm wondering why the build failure wasn't fixed by a patch like this:
net/bluetooth/hci_sock.c +0
-2@@ -348,8 +348,6 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_skb_get_timestamp (skb, &tv); - data = &tv; - len =sizeof (tv);#ifdef CONFIG_COMPAT if (msg->msg_flags &MSG_CMSG_COMPAT ) {struct compat_timeval ctv;
net/bluetooth/hci_sock.c static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_ · line 364
Quoted 9 lines
net/bluetooth/hci_sock.c +3
-0@@ -358,6 +356,9 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_ data = &ctv; len = sizeof(ctv); } +#else + data = &tv; + len =sizeof (tv);#endif put_cmsg (msg,SOL_HCI ,HCI_CMSG_TSTAMP , len, data);
because that is wrong and will give you a different issue (the other way around actually) that the change to use compat_timeval actually tried to fix. Your patch actually will allow to return arbitrary kernel memory in case of 64-bit applications since data and len might not be initialized.
In case of 64-bit kernels you can have 64-bit or 32-bit applications. In case of 32-bit application you have to return compat_timeval and in cas of 64-bit application you have to return timeval. It is checked by MSG_CMSG_COMPAT runtime flag and not the CONFIG_COMPAT compile option.
Regards
Marcel