From: Johan Hedberg Date: Wed, 16 Jul 2014 08:56:09 +0000 (+0300) Subject: Bluetooth: Fix trying to initiate connections when acting as LE slave X-Git-Tag: v4.14-rc1~7092^2~12^2~41^2~29 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f99353cf9c061bc1700b6a49ee98cae93e28207b;p=platform%2Fkernel%2Flinux-rpi.git Bluetooth: Fix trying to initiate connections when acting as LE slave When we have at least one LE slave connection most (probably all) controllers will refuse to initiate any new connections. To avoid unnecessary failures simply check for this situation up-front and skip the connection attempt. Signed-off-by: Johan Hedberg Signed-off-by: Marcel Holtmann --- diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index c68b93e..e54db7f 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -4246,6 +4246,12 @@ static void check_pending_le_conn(struct hci_dev *hdev, bdaddr_t *addr, if (hci_bdaddr_list_lookup(&hdev->blacklist, addr, addr_type)) return; + /* Most controller will fail if we try to create new connections + * while we have an existing one in slave role. + */ + if (hdev->conn_hash.le_num_slave > 0) + return; + /* If we're connectable, always connect any ADV_DIRECT_IND event */ if (test_bit(HCI_CONNECTABLE, &hdev->dev_flags) && adv_type == LE_ADV_DIRECT_IND)