All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ] gatt: Fix registering DIS without a valid source
@ 2021-03-05 22:25 Luiz Augusto von Dentz
  2021-03-05 23:00 ` [BlueZ] " bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2021-03-05 22:25 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

If source has not been set don't register DIS as it would not contain
any useful information and by doing this it actually allows systems to
register their own DIS instance.

Fixes https://github.com/bluez/bluez/issues/101
---
 src/gatt-database.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/gatt-database.c b/src/gatt-database.c
index bd5864bcd..6c9e19ff3 100644
--- a/src/gatt-database.c
+++ b/src/gatt-database.c
@@ -1241,22 +1241,23 @@ static void device_info_read_pnp_id_cb(struct gatt_db_attribute *attrib,
 static void populate_devinfo_service(struct btd_gatt_database *database)
 {
 	struct gatt_db_attribute *service;
+	struct gatt_db_attribute *attrib;
 	bt_uuid_t uuid;
 
+	/* Only register DIS if source has been set */
+	if (!btd_opts.did_source)
+		return;
+
 	bt_uuid16_create(&uuid, UUID_DIS);
 	service = gatt_db_add_service(database->db, &uuid, true, 3);
 
-	if (btd_opts.did_source > 0) {
-		struct gatt_db_attribute *attrib;
-
-		bt_uuid16_create(&uuid, GATT_CHARAC_PNP_ID);
-		attrib = gatt_db_service_add_characteristic(service, &uuid,
+	bt_uuid16_create(&uuid, GATT_CHARAC_PNP_ID);
+	attrib = gatt_db_service_add_characteristic(service, &uuid,
 						BT_ATT_PERM_READ,
 						BT_GATT_CHRC_PROP_READ,
 						device_info_read_pnp_id_cb,
 						NULL, database);
-		gatt_db_attribute_set_fixed_length(attrib, 7);
-	}
+	gatt_db_attribute_set_fixed_length(attrib, 7);
 
 	gatt_db_service_set_active(service, true);
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [BlueZ] gatt: Fix registering DIS without a valid source
  2021-03-05 22:25 [PATCH BlueZ] gatt: Fix registering DIS without a valid source Luiz Augusto von Dentz
@ 2021-03-05 23:00 ` bluez.test.bot
  0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2021-03-05 23:00 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

[-- Attachment #1: Type: text/plain, Size: 557 bytes --]

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=443009

---Test result---

##############################
Test: CheckPatch - PASS

##############################
Test: CheckGitLint - PASS

##############################
Test: CheckBuild - PASS

##############################
Test: MakeCheck - PASS



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-05 23:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-05 22:25 [PATCH BlueZ] gatt: Fix registering DIS without a valid source Luiz Augusto von Dentz
2021-03-05 23:00 ` [BlueZ] " bluez.test.bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.