Module Name:    src
Committed By:   riz
Date:           Sun Nov 21 21:38:19 UTC 2010

Modified Files:
        src/sys/netbt [netbsd-4]: hci_link.c

Log Message:
Pull up following revision(s) (requested by plunky in ticket #1409):
        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.8.2.1 -r1.8.2.2 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.8.2.1 src/sys/netbt/hci_link.c:1.8.2.2
--- src/sys/netbt/hci_link.c:1.8.2.1	Thu Jul 19 16:04:18 2007
+++ src/sys/netbt/hci_link.c	Sun Nov 21 21:38:19 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: hci_link.c,v 1.8.2.1 2007/07/19 16:04:18 liamjfoy Exp $	*/
+/*	$NetBSD: hci_link.c,v 1.8.2.2 2010/11/21 21:38:19 riz Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hci_link.c,v 1.8.2.1 2007/07/19 16:04:18 liamjfoy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hci_link.c,v 1.8.2.2 2010/11/21 21:38:19 riz Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -453,10 +453,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;
 	}
 

Reply via email to