summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorArkadiusz Lichwa <arkadiusz.lichwa@tieto.com>2016-09-15 13:59:21 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2016-10-21 07:47:31 +0300
commitbe817c8ef539227345241b7fbbbaebb841996126 (patch)
tree1d4a056408776d5f6056dfb8d1fd7920eaf07927 /net
parentd99e0c3cecf27f09019771e8ee32964fc42068db (diff)
Bluetooth: L2CAP: Handle security procedure non successful path
When getting non-zero status from security procedure on BR/EDR connection, make sure to react properly based on connection path (in or out) by sending in first case security block response if needed and in second case release hanging channel if exists in CONNECT context. > ACL Data RX: Handle 11 flags 0x02 dlen 12 [hci1] 130.819662 L2CAP: Connection Request (0x02) ident 5 len 4 PSM: 5 (0x0005) Source CID: 65 < HCI Command: Authentication Requested (0x01|0x0011) plen 2 [hci1] 130.825611 Handle: 11 > HCI Event: Command Status (0x0f) plen 4 [hci1] 130.826519 Authentication Requested (0x01|0x0011) ncmd 1 Status: Success (0x00) > HCI Event: Link Key Request (0x17) plen 6 [hci1] 130.827516 Address: 00:1A:7D:DA:71:0B (cyber-blue(HK)Ltd) < HCI Command: Host Number of Complet.. (0x03|0x0035) plen 5 [hci1] 130.828348 Num handles: 1 Handle: 11 Count: 1 < ACL Data TX: Handle 11 flags 0x00 dlen 16 [hci1] 130.829717 L2CAP: Connection Response (0x03) ident 5 len 8 Destination CID: 65 Source CID: 65 Result: Connection pending (0x0001) Status: Authentication pending (0x0001) < HCI Command: Link Key Request Reply (0x01|0x000b) plen 22 [hci1] 130.830594 Address: 00:1A:7D:DA:71:0B (cyber-blue(HK)Ltd) Link key: fa087afc920ffe07199c803005fc5b5f > HCI Event: Command Complete (0x0e) plen 10 [hci1] 130.833513 Link Key Request Reply (0x01|0x000b) ncmd 1 Status: Success (0x00) Address: 00:1A:7D:DA:71:0B (cyber-blue(HK)Ltd) > HCI Event: PIN Code Request (0x16) plen 6 [hci1] 130.852526 Address: 00:1A:7D:DA:71:0B (cyber-blue(HK)Ltd) > HCI Event: Number of Completed Packets (0x13) plen 5 [hci1] 131.071542 Num handles: 1 Handle: 11 Count: 1 < HCI Command: PIN Code Request Negat.. (0x01|0x000e) plen 6 [hci1] 154.501040 Address: 00:1A:7D:DA:71:0B (cyber-blue(HK)Ltd) > HCI Event: Command Complete (0x0e) plen 10 [hci1] 154.502365 PIN Code Request Negative Reply (0x01|0x000e) ncmd 1 Status: Success (0x00) Address: 00:1A:7D:DA:71:0B (cyber-blue(HK)Ltd) > HCI Event: Auth Complete (0x06) plen 3 [hci1] 154.503360 Status: PIN or Key Missing (0x06) Handle: 11 < ACL Data TX: Handle 11 flags 0x00 dlen 16 [hci1] 154.506130 L2CAP: Connection Response (0x03) ident 5 len 8 Destination CID: 65 Source CID: 65 Result: Connection refused - security block (0x0003) Status: No further information available (0x0000) > HCI Event: Number of Completed Packets (0x13) plen 5 [hci1] 154.699369 Num handles: 1 Handle: 11 Count: 1 Change-Id: I9e9a9b456c00452efb4f5303aa1b1fd1fa81b758 Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/l2cap_br.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/net/bluetooth/l2cap_br.c b/net/bluetooth/l2cap_br.c
index 470aca671..43e820b35 100644
--- a/net/bluetooth/l2cap_br.c
+++ b/net/bluetooth/l2cap_br.c
@@ -1575,6 +1575,23 @@ static void l2cap_br_conn_pend(struct bt_l2cap_chan *chan, uint8_t status)
BT_DBG("chan %p status 0x%02x encr 0x%02x", chan, status,
chan->conn->encrypt);
+ if (status) {
+ /*
+ * Security procedure status is non-zero so respond with
+ * security violation only as channel acceptor.
+ */
+ l2cap_br_conn_req_reply(chan, BT_L2CAP_ERR_SEC_BLOCK);
+
+ /* Release channel allocated to outgoing connection request */
+ if (atomic_test_bit(BR_CHAN(chan)->flags,
+ L2CAP_FLAG_CONN_PENDING)) {
+ l2cap_br_detach_chan(chan->conn, chan);
+ bt_l2cap_chan_del(chan);
+ }
+
+ return;
+ }
+
if (!chan->conn->encrypt) {
return;
}