Bluetooth: Improve error handling in connect acl
authorLukasz Rymanowski <lukasz.rymanowski@tieto.com>
Wed, 11 Feb 2015 11:31:41 +0000 (12:31 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Sat, 14 Feb 2015 04:19:59 +0000 (05:19 +0100)
With this patch -EOPNOTSUPP will be returned by hci_connect_acl for LE
only controllers. If it is dual device with disabled BREDR -ECONNREFUSED
will be returned

Signed-off-by: Lukasz Rymanowski <lukasz.rymanowski@tieto.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
net/bluetooth/hci_conn.c

index 409c05e9e00a127fffd2da23f78507a1a4011a03..e3263b61bcf356afe81d1968804aad7ff98fee6a 100644 (file)
@@ -864,8 +864,12 @@ struct hci_conn *hci_connect_acl(struct hci_dev *hdev, bdaddr_t *dst,
 {
        struct hci_conn *acl;
 
-       if (!test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags))
+       if (!test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags)) {
+               if (lmp_bredr_capable(hdev))
+                       return ERR_PTR(-ECONNREFUSED);
+
                return ERR_PTR(-EOPNOTSUPP);
+       }
 
        acl = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst);
        if (!acl) {