Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752223AbeAQDsC (ORCPT + 1 other); Tue, 16 Jan 2018 22:48:02 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:13707 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752211AbeAQDr5 (ORCPT ); Tue, 16 Jan 2018 22:47:57 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20180117034755epoutp0290d385963ec8275f74d55f16fbf143bb~KfEiQW_R90621406214epoutp02f X-AuditID: b6c32a4a-b91ff70000001151-53-5a5ec76b6122 From: Guo Yi To: linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: marcel@holtmann.org, gustavo@padovan.org, johan.hedberg@gmail.com, davem@davemloft.net, Guo Yi Subject: [PATCH] Bluetooth: 6lowpan: Fix disconnect bug in 6lowpan Date: Wed, 17 Jan 2018 11:47:28 +0800 Message-Id: <1516160848-471-1-git-send-email-yi2010.guo@samsung.com> X-Mailer: git-send-email 2.7.4 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrGIsWRmVeSWpSXmKPExsWy7bCmpm728bgogz+rhC3mnG9hsdj5YBe7 xa6px5gt5lzrY7a4vGsOm8W3T78YLY4tELPoW9jG6sDhsWXlTSaPnbPusnus372c3WPnpL1M Hn1bVjF6fN4kF8AWxWWTkpqTWZZapG+XwJVx6O4J9oLXPBW9nWYNjJu5uhg5OCQETCTOPlPq YuTiEBLYzSix/MY7FgjnE6PEid132LoYOYGcb4wSK49xgdggDR8WLmOGKNrLKPFn4kQmCOcr o8T+xw8YQarYBFQlHkxuZwexRQSiJc6vf8oEso5ZoFaiabY6SFhYwEni5dxtrCA2C1D531cn wVp5BVwk9t3tY4dYJidx81wn2DIJgQlsEguWLmCBSLhIvF05CcoWlnh1fAtUg5TEy/42KLta YufuSewQzR2MEju+PmWG+NlaYvU5QYh7NCXW79KHKLeVmH14I9g9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p9WNcU2dWqDKufX3JUWXye78vChW50w6p XfjhOfWaJ2em6p34+gpjwxM5ybVzqo2vcJ2d8rTmxAq/ObnrFkv9ZLqRrsRSnJFoqMVcVJwI ACq19q0oAgAA X-CMS-MailID: 20180117034755epcas5p1437f6831b91eb594a1106f0960204b81 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-MTR: 20180117034755epcas5p1437f6831b91eb594a1106f0960204b81 CMS-TYPE: 105P X-CMS-RootMailID: 20180117034755epcas5p1437f6831b91eb594a1106f0960204b81 X-RootMTR: 20180117034755epcas5p1437f6831b91eb594a1106f0960204b81 References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: This patch fix the bluetooth 6lowpan disconnect fail bug. The type of the same address type have different define value in HCI layer and L2CAP layer.That makes disconnect fail due to wrong network type.User will not be able to disconnect from console with the network type that used in connect. This patch add a var lookup_type, and covert the channel address type to HCI address type. By these means, user can disconnect successfuly. Signed-off-by: Guo Yi --- net/bluetooth/6lowpan.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c index 795ddd8..332dddb 100644 --- a/net/bluetooth/6lowpan.c +++ b/net/bluetooth/6lowpan.c @@ -1104,11 +1104,18 @@ static int get_l2cap_conn(char *buf, bdaddr_t *addr, u8 *addr_type, struct hci_dev *hdev; bdaddr_t *src = BDADDR_ANY; int n; + u8 lookup_type; n = sscanf(buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx %hhu", &addr->b[5], &addr->b[4], &addr->b[3], &addr->b[2], &addr->b[1], &addr->b[0], addr_type); + /* Convert from L2CAP channel address type to HCI address type + */ + if (*addr_type == BDADDR_LE_PUBLIC) + lookup_type = ADDR_LE_DEV_PUBLIC; + else + lookup_type = ADDR_LE_DEV_RANDOM; if (n < 7) return -EINVAL; @@ -1118,7 +1125,7 @@ static int get_l2cap_conn(char *buf, bdaddr_t *addr, u8 *addr_type, return -ENOENT; hci_dev_lock(hdev); - hcon = hci_conn_hash_lookup_le(hdev, addr, *addr_type); + hcon = hci_conn_hash_lookup_le(hdev, addr, lookup_type); hci_dev_unlock(hdev); if (!hcon) -- 2.7.4