From d32e2a336b76cd84ff3fa770a69d7d1f9d0e2e75 Mon Sep 17 00:00:00 2001
From: Gopal Tiwari <gtiwari@redhat.com>
Date: Thu, 25 Apr 2019 19:37:20 +0530
Subject: [PATCH BlueZ] device: Fix crashing when connecting ATT over
BR/EDR
commit 006213cf4d231ce66de273e96619474bd516359b
Author: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: Fri Jul 7 10:35:11 2017 +0300
device: Fix crashing when connecting ATT over BR/EDR
---
src/device.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/device.c b/src/device.c
index 8693eb826..4d2a59522 100644
--- a/src/device.c
+++ b/src/device.c
@@ -136,6 +136,7 @@ struct authentication_req {
struct browse_req {
DBusMessage *msg;
struct btd_device *device;
+ uint8_t bdaddr_type;
GSList *match_uuids;
GSList *profiles_added;
sdp_list_t *records;
@@ -2154,6 +2155,9 @@ static void browse_request_complete(struct browse_req *req, uint8_t bdaddr_type,
struct btd_device *dev = req->device;
DBusMessage *reply = NULL;
+ if (req->bdaddr_type != bdaddr_type)
+ return;
+
if (!req->msg)
goto done;
@@ -4955,6 +4959,7 @@ int device_connect_le(struct btd_device *dev)
}
static struct browse_req *browse_request_new(struct btd_device *device,
+ uint8_t bdaddr_type,
DBusMessage *msg)
{
struct browse_req *req;
@@ -4964,6 +4969,7 @@ static struct browse_req *browse_request_new(struct btd_device *device,
req = g_new0(struct browse_req, 1);
req->device = device;
+ req->bdaddr_type = bdaddr_type;
device->browse = req;
@@ -4989,7 +4995,7 @@ static int device_browse_gatt(struct btd_device *device, DBusMessage *msg)
struct btd_adapter *adapter = device->adapter;
struct browse_req *req;
- req = browse_request_new(device, msg);
+ req = browse_request_new(device, device->bdaddr_type, msg);
if (!req)
return -EBUSY;
@@ -5062,7 +5068,7 @@ static int device_browse_sdp(struct btd_device *device, DBusMessage *msg)
uuid_t uuid;
int err;
- req = browse_request_new(device, msg);
+ req = browse_request_new(device, BDADDR_BREDR, msg);
if (!req)
return -EBUSY;
--
2.17.2