Skip to content

Commit

Permalink
[BLUETOOTH]: Fix unaligned access in hci_send_to_sock.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David S. Miller committed Nov 22, 2006
1 parent 785fd8b commit 4498c80
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions net/bluetooth/hci_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,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;
}

Expand Down

0 comments on commit 4498c80

Please sign in to comment.