Module Name: src
Committed By: riz
Date: Sun Nov 21 21:36:07 UTC 2010
Modified Files:
src/sys/netbt [netbsd-5]: hci_link.c
Log Message:
Pull up following revision(s) (requested by plunky in ticket #1461):
sys/netbt/hci_link.c: revision 1.22
Some Broadcom controllers emit empty ACL packets during connection
setup, using the handle that they have not yet told us for the
connection-to-be. Disconnecting can cause problems so just ignore
zero length ACL packets on unknown connection handles.
fixes a problem reported by Nick Hudson
To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.20.12.1 src/sys/netbt/hci_link.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/netbt/hci_link.c
diff -u src/sys/netbt/hci_link.c:1.20 src/sys/netbt/hci_link.c:1.20.12.1
--- src/sys/netbt/hci_link.c:1.20 Thu Apr 24 11:38:37 2008
+++ src/sys/netbt/hci_link.c Sun Nov 21 21:36:07 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: hci_link.c,v 1.20 2008/04/24 11:38:37 ad Exp $ */
+/* $NetBSD: hci_link.c,v 1.20.12.1 2010/11/21 21:36:07 riz Exp $ */
/*-
* Copyright (c) 2005 Iain Hibbert.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hci_link.c,v 1.20 2008/04/24 11:38:37 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hci_link.c,v 1.20.12.1 2010/11/21 21:36:07 riz Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -450,10 +450,16 @@
* for, just get rid of it. This may happen, if a USB dongle
* is plugged into a self powered hub and does not reset when
* the system is shut down.
+ *
+ * This can cause a problem with some Broadcom controllers
+ * which emit empty ACL packets during connection setup, so
+ * only disconnect where data is present.
*/
- cp.con_handle = htole16(handle);
- cp.reason = 0x13; /* "Remote User Terminated Connection" */
- hci_send_cmd(unit, HCI_CMD_DISCONNECT, &cp, sizeof(cp));
+ if (hdr.length > 0) {
+ cp.con_handle = htole16(handle);
+ cp.reason = 0x13;/*"Remote User Terminated Connection"*/
+ hci_send_cmd(unit, HCI_CMD_DISCONNECT, &cp, sizeof(cp));
+ }
goto bad;
}