From d96c2fd877a318a373347b4befa1ec6b9a46a952 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Fri, 11 Feb 2022 14:00:51 -0800 Subject: [PATCH] adapter: Fix allowing multiple adapters with the same address The bdaddr of an adapter is used for its unique storage path so having multiple adapters with the same address would likely cause problems with its storage as they would be shared. --- src/adapter.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/adapter.c b/src/adapter.c index 1551011a8..97ce26f8e 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -9807,6 +9807,16 @@ static void read_info_complete(uint8_t status, uint16_t length, goto failed; } } else { + struct btd_adapter *tmp; + + tmp = adapter_find(&rp->bdaddr); + if (tmp) { + btd_error(adapter->dev_id, + "Bluetooth address for index %u match index %u", + adapter->dev_id, tmp->dev_id); + goto failed; + } + bacpy(&adapter->bdaddr, &rp->bdaddr); if (!(adapter->supported_settings & MGMT_SETTING_LE)) adapter->bdaddr_type = BDADDR_BREDR; -- 2.47.3