|
@@ -3220,13 +3220,28 @@ static bool is_connected(struct hci_dev *hdev, bdaddr_t *addr, u8 type)
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+static bool is_identity_address(bdaddr_t *addr, u8 addr_type)
|
|
|
+{
|
|
|
+ if (addr_type == ADDR_LE_DEV_PUBLIC)
|
|
|
+ return true;
|
|
|
+
|
|
|
+ /* Check for Random Static address type */
|
|
|
+ if ((addr->b[5] & 0xc0) == 0xc0)
|
|
|
+ return true;
|
|
|
+
|
|
|
+ return false;
|
|
|
+}
|
|
|
+
|
|
|
/* This function requires the caller holds hdev->lock */
|
|
|
-void hci_conn_params_add(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type,
|
|
|
- u8 auto_connect, u16 conn_min_interval,
|
|
|
- u16 conn_max_interval)
|
|
|
+int hci_conn_params_add(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type,
|
|
|
+ u8 auto_connect, u16 conn_min_interval,
|
|
|
+ u16 conn_max_interval)
|
|
|
{
|
|
|
struct hci_conn_params *params;
|
|
|
|
|
|
+ if (!is_identity_address(addr, addr_type))
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
params = hci_conn_params_lookup(hdev, addr, addr_type);
|
|
|
if (params)
|
|
|
goto update;
|
|
@@ -3234,7 +3249,7 @@ void hci_conn_params_add(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type,
|
|
|
params = kzalloc(sizeof(*params), GFP_KERNEL);
|
|
|
if (!params) {
|
|
|
BT_ERR("Out of memory");
|
|
|
- return;
|
|
|
+ return -ENOMEM;
|
|
|
}
|
|
|
|
|
|
bacpy(¶ms->addr, addr);
|
|
@@ -3261,6 +3276,8 @@ update:
|
|
|
BT_DBG("addr %pMR (type %u) auto_connect %u conn_min_interval 0x%.4x "
|
|
|
"conn_max_interval 0x%.4x", addr, addr_type, auto_connect,
|
|
|
conn_min_interval, conn_max_interval);
|
|
|
+
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
/* This function requires the caller holds hdev->lock */
|