Blame 018d852f860c415bf68897820570432ba9b0ba04.patch

a172043
From 018d852f860c415bf68897820570432ba9b0ba04 Mon Sep 17 00:00:00 2001
a172043
From: John Sullivan <jsgthb@kanargh.org.uk>
a172043
Date: Mon, 23 Nov 2020 11:03:05 +0000
a172043
Subject: [PATCH] avoid deadlock when handling notifications/indications
a172043
a172043
---
a172043
 src/bluez/attrib/gattrib.c | 5 ++++-
a172043
 1 file changed, 4 insertions(+), 1 deletion(-)
a172043
a172043
diff --git a/src/bluez/attrib/gattrib.c b/src/bluez/attrib/gattrib.c
a172043
index ac5fc4b..593ddd0 100644
a172043
--- a/src/bluez/attrib/gattrib.c
a172043
+++ b/src/bluez/attrib/gattrib.c
a172043
@@ -475,8 +475,11 @@ static gboolean received_data(GIOChannel *io, GIOCondition cond, gpointer data)
a172043
 	for (l = attrib->events; l; l = l->next) {
a172043
 		struct event *evt = l->data;
a172043
 
a172043
-		if (match_event(evt, buf, len))
a172043
+		if (match_event(evt, buf, len)) {
a172043
+			AUNLOCK(attrib);
a172043
 			evt->func(buf, len, evt->user_data);
a172043
+			ALOCK(attrib);
a172043
+		}
a172043
 	}
a172043
 
a172043
 	if (!is_response(buf[0])) {