]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
BLUETOOTH: Fix unaligned access in hci_send_to_sock.
authorDavid S. Miller <davem@davemloft.net>
Thu, 25 Jan 2007 18:36:01 +0000 (19:36 +0100)
committerAdrian Bunk <bunk@stusta.de>
Thu, 25 Jan 2007 18:36:01 +0000 (19:36 +0100)
The "u16 *" derefs of skb->data need to be wrapped inside of
a get_unaligned().

Thanks to Gustavo Zacarias for the bug report.

Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
net/bluetooth/hci_sock.c

index 97bdec73d17e9fcbc4ffdfcb75c5613c3b9e9c44..4e86ff478352a4078a27e1a57061809a4560f855 100644 (file)
@@ -121,10 +121,13 @@ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb)
                        if (!hci_test_bit(evt, &flt->event_mask))
                                continue;
 
-                       if (flt->opcode && ((evt == HCI_EV_CMD_COMPLETE && 
-                                       flt->opcode != *(__u16 *)(skb->data + 3)) ||
-                                       (evt == HCI_EV_CMD_STATUS && 
-                                       flt->opcode != *(__u16 *)(skb->data + 4))))
+                       if (flt->opcode &&
+                           ((evt == HCI_EV_CMD_COMPLETE &&
+                             flt->opcode !=
+                             get_unaligned((__u16 *)(skb->data + 3))) ||
+                            (evt == HCI_EV_CMD_STATUS &&
+                             flt->opcode !=
+                             get_unaligned((__u16 *)(skb->data + 4)))))
                                continue;
                }