Unaligned accesses in hci_send_to_sock
I'm getting multiple unaligned accesses when using the bluetooth subsystem.
Kernel unaligned access at TPC[10247dc4] hci_send_to_sock+0xb4/0x174 [bluetooth]
With my limited kernel module debugging skills i think the culprit is at net/bluetooth/hci_sock.c lines 123-126:
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))))That looks terrible or am i wrong?
Best regards.
Signature · 2 lines
Gustavo Zacarias Gentoo/SPARC monkey
From: Gustavo Zacarias <[email protected]>
Date: Fri, 17 Nov 2006 12:47:26 -0300
Quoted 6 lines
Kernel unaligned access at TPC[10247dc4]
hci_send_to_sock+0xb4/0x174[bluetooth]With my limited kernel module debugging skills i think the culprit is at
net/bluetooth/hci_sock.clines 123-126:
Quoted 6 lines
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))))That looks terrible or am i wrong?
Thanks for the report. This patch should fix the problem.
[ Marcel, I'd like to send this in to Linus if you don't mind. ]
net/bluetooth/hci_sock.c +5 -4
@@ -120,10 +120,13 @@ void hci_send_to_sock(struct hci_dev *hdif (!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 ; }