All of lore.kernel.org
 help / color / mirror / Atom feed
* Unaligned accesses in hci_send_to_sock
@ 2006-11-17 15:47 Gustavo Zacarias
  2006-11-21  0:33 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Gustavo Zacarias @ 2006-11-17 15:47 UTC (permalink / raw)
  To: sparclinux


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.

-- 
Gustavo Zacarias
Gentoo/SPARC monkey

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Unaligned accesses in hci_send_to_sock
  2006-11-17 15:47 Unaligned accesses in hci_send_to_sock Gustavo Zacarias
@ 2006-11-21  0:33 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2006-11-21  0:33 UTC (permalink / raw)
  To: sparclinux

From: Gustavo Zacarias <gustavoz@gentoo.org>
Date: Fri, 17 Nov 2006 12:47:26 -0300

> 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?

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. ]

diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index f26a9eb..3bf9222 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -120,10 +120,13 @@ void hci_send_to_sock(struct hci_dev *hd
 			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;
 		}
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-11-21  0:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-17 15:47 Unaligned accesses in hci_send_to_sock Gustavo Zacarias
2006-11-21  0:33 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.