Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netbt Some Broadcom controllers emit empty ACL packets d...



details:   https://anonhg.NetBSD.org/src/rev/52d3c16d7e0e
branches:  trunk
changeset: 758028:52d3c16d7e0e
user:      plunky <plunky%NetBSD.org@localhost>
date:      Thu Oct 14 07:05:03 2010 +0000

description:
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

diffstat:

 sys/netbt/hci_link.c |  16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diffs (38 lines):

diff -r fb274eb5d789 -r 52d3c16d7e0e sys/netbt/hci_link.c
--- a/sys/netbt/hci_link.c      Thu Oct 14 06:58:22 2010 +0000
+++ b/sys/netbt/hci_link.c      Thu Oct 14 07:05:03 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hci_link.c,v 1.21 2009/09/24 19:35:09 plunky Exp $     */
+/*     $NetBSD: hci_link.c,v 1.22 2010/10/14 07:05:03 plunky Exp $     */
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hci_link.c,v 1.21 2009/09/24 19:35:09 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hci_link.c,v 1.22 2010/10/14 07:05:03 plunky Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -467,10 +467,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;
        }
 



Home | Main Index | Thread Index | Old Index