From: Luiz Augusto von Dentz <[email protected]>
When updating the device address check if the device is marked as
temporary before attempting to call store_device_info otherwise it will
have no effect and instead btd_device_set_temporary must be called.
---
src/device.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/device.c b/src/device.c
index df50ce7b4f6c..652c03606b9e 100644
--- a/src/device.c
+++ b/src/device.c
@@ -4412,7 +4412,10 @@ void device_update_addr(struct btd_device *device, const bdaddr_t *bdaddr,
bacpy(&device->bdaddr, bdaddr);
device->bdaddr_type = bdaddr_type;
- store_device_info(device);
+ if (device->temporary)
+ btd_device_set_temporary(device, false);
+ else
+ store_device_info(device);
g_dbus_emit_property_changed(dbus_conn, device->path,
DEVICE_INTERFACE, "Address");
--
2.39.2
From: Luiz Augusto von Dentz <[email protected]>
This checks cid before attempting to create device, if the device is
using an RPA it could be that the MGMT event has not been processed yet
which would lead to create a second copy of the same device using its
identity address.
---
src/gatt-database.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/gatt-database.c b/src/gatt-database.c
index ea282d4bc193..3b53bf2a3c84 100644
--- a/src/gatt-database.c
+++ b/src/gatt-database.c
@@ -632,6 +632,7 @@ static void connect_cb(GIOChannel *io, GError *gerr, gpointer user_data)
struct btd_device *device;
uint8_t dst_type;
bdaddr_t src, dst;
+ uint16_t cid;
if (gerr) {
error("%s", gerr->message);
@@ -641,6 +642,7 @@ static void connect_cb(GIOChannel *io, GError *gerr, gpointer user_data)
bt_io_get(io, &gerr, BT_IO_OPT_SOURCE_BDADDR, &src,
BT_IO_OPT_DEST_BDADDR, &dst,
BT_IO_OPT_DEST_TYPE, &dst_type,
+ BT_IO_OPT_CID, &cid,
BT_IO_OPT_INVALID);
if (gerr) {
error("bt_io_get: %s", gerr->message);
@@ -655,9 +657,21 @@ static void connect_cb(GIOChannel *io, GError *gerr, gpointer user_data)
if (!adapter)
return;
- device = btd_adapter_get_device(adapter, &dst, dst_type);
- if (!device)
+ /* Check cid before attempting to create device, if the device is using
+ * an RPA it could be that the MGMT event has not been processed yet
+ * which would lead to create a second copy of the same device using its
+ * identity address.
+ */
+ if (cid == BT_ATT_CID)
+ device = btd_adapter_get_device(adapter, &dst, dst_type);
+ else
+ device = btd_adapter_find_device(adapter, &dst, dst_type);
+
+ if (!device) {
+ error("Unable to find device, dropping connection attempt");
+ g_io_channel_shutdown(io, FALSE, NULL);
return;
+ }
device_attach_att(device, io);
}
--
2.39.2
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=727684
---Test result---
Test Summary:
CheckPatch PASS 0.71 seconds
GitLint PASS 0.49 seconds
BuildEll PASS 26.25 seconds
BluezMake PASS 763.65 seconds
MakeCheck PASS 11.06 seconds
MakeDistcheck PASS 154.66 seconds
CheckValgrind PASS 241.74 seconds
CheckSmatch PASS 323.62 seconds
bluezmakeextell PASS 97.21 seconds
IncrementalBuild PASS 1235.69 seconds
ScanBuild WARNING 983.36 seconds
Details
##############################
Test: ScanBuild - WARNING
Desc: Run Scan Build
Output:
src/gatt-database.c:1152:10: warning: Value stored to 'bits' during its initialization is never read
uint8_t bits[] = { BT_GATT_CHRC_CLI_FEAT_ROBUST_CACHING,
^~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
---
Regards,
Linux Bluetooth
Hello:
This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <[email protected]>:
On Tue, 7 Mar 2023 16:51:57 -0800 you wrote:
> From: Luiz Augusto von Dentz <[email protected]>
>
> When updating the device address check if the device is marked as
> temporary before attempting to call store_device_info otherwise it will
> have no effect and instead btd_device_set_temporary must be called.
> ---
> src/device.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
Here is the summary with links:
- [BlueZ,1/2] device: Fix not always storing device info
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=581aae6a2722
- [BlueZ,2/2] gatt: Fix creating duplicated objects
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=3842320f450e
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html