Skip to contentSkip to conversation

Fix duplicate free for GATT service includes

PATCH Applied Pavel Maltsev 3 participants 3 messages Nov 20, 2020 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix duplicate free for GATT service includes

Objects in the service->includes queue are obtained via dbus_message_iter_get_basic call and according to the contract for the value is that it is returned by the reference and should not be freed thus we should make a copy.

This will fix the issue when the GATT service app is disconnected (reproduced with gatt-service included in bluez), bluetoothd is crashing:

src/gatt-database.c:gatt_db_service_removed() Local GATT service removed src/adapter.c:adapter_service_remove() /org/bluez/hci0 src/adapter.c:remove_uuid() sending remove uuid command for index 0 src/gatt-database.c:proxy_removed_cb() Proxy removed - removing service: /serv1 munmap_chunk(): invalid pointer

---
 src/gatt-database.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
src/gatt-database.c +6 -1
index 6694a0174..90cc4bade 100644
@@ -1999,6 +1999,7 @@ static bool parse_includes(GDBusProxy *proxy, struct external_service *service)
 	DBusMessageIter iter;
 	DBusMessageIter array;
 	char *obj;
+	char *includes;
 	int type;
 
 	/* Includes property is optional */
@@ -2017,7 +2018,11 @@ static bool parse_includes(GDBusProxy *proxy, struct external_service *service)
 
 		dbus_message_iter_get_basic(&array, &obj);
 
-		if (!queue_push_tail(service->includes, obj)) {
+		includes = g_strdup(obj);
+		if (!includes)
+			return false;
+
+		if (!queue_push_tail(service->includes, includes)) {
 			error("Failed to add Includes path in queue\n");
 			return false;
 		}
Signature · 1 line
2.29.2.454.gaff20da3a2-goog
#1 lore raw

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

---Test result---

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

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

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

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

---
Regards,
Linux Bluetooth

maintainer Applied
#2 lore raw

Hi Pavel,

Quoted 20 lines · On Thu, Nov 19, 2020 at 5:06 PM <[email protected]> wrote:

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

---Test result---

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

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

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

Quoted 9 lines

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

---
Regards,
Linux Bluetooth

Applied, thanks.

Signature · 1 line
Luiz Augusto von Dentz