Merge ~kzapalowicz/bluez:fix/cherrypick-from-upstream-sony-crash into ~bluetooth/bluez:artful

Proposed by Konrad Zapałowicz on 2017-08-21
Status: Merged
Approved by: Daniel van Vugt on 2017-08-23
Approved revision: 6c7818c35b2cdbb934af6ac2e2a5c5109404a283
Merged at revision: 6c7818c35b2cdbb934af6ac2e2a5c5109404a283
Proposed branch: ~kzapalowicz/bluez:fix/cherrypick-from-upstream-sony-crash
Merge into: ~bluetooth/bluez:artful
Diff against target: 186 lines (+164/-0)
3 files modified
debian/changelog (+8/-0)
debian/patches/0001-device-Fix-crash-when-connecting-ATT-with-BR-EDR-onl.patch (+155/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Daniel van Vugt 2017-08-21 Approve on 2017-08-23
Review via email: mp+329308@code.launchpad.net

Description of the Change

Cherry-pick a fix for a crash from upstream.

To post a comment you must log in.
Daniel van Vugt (vanvugt) wrote :

Looks good to me. That's the same as what I was going to do...

I was hoping we could figure out the exact bug ID of the crash in advance but I think this is going to be one of those we confirm afterwards (when errors.ubuntu.com shows a crash has stopped happening in version 5.46-0ubuntu2).

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 0a00f5f..f3692ac 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,11 @@
6+bluez (5.46-0ubuntu2) UNRELEASED; urgency=medium
7+
8+ * debian/patches/0001-device-Fix-crash-when-connecting-ATT-with-BR-EDR-onl.patch
9+ - fix crash when conecting ATT with BR/EDR only device. cherry-picked
10+ from upstream.
11+
12+ -- Konrad Zapałowicz <konrad.zapalowicz@canonical.com> Mon, 21 Aug 2017 15:34:15 +0200
13+
14 bluez (5.46-0ubuntu1) artful; urgency=medium
15
16 [ Konrad Zapałowicz ]
17diff --git a/debian/patches/0001-device-Fix-crash-when-connecting-ATT-with-BR-EDR-onl.patch b/debian/patches/0001-device-Fix-crash-when-connecting-ATT-with-BR-EDR-onl.patch
18new file mode 100644
19index 0000000..484d458
20--- /dev/null
21+++ b/debian/patches/0001-device-Fix-crash-when-connecting-ATT-with-BR-EDR-onl.patch
22@@ -0,0 +1,155 @@
23+From 0c1b55d7efaede3b5070cbdccdea248279f59a51 Mon Sep 17 00:00:00 2001
24+From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
25+Date: Wed, 9 Aug 2017 14:14:23 +0300
26+Subject: device: Fix crash when connecting ATT with BR/EDR only device
27+
28+* device.c: fix the crash
29+
30+Origin: upstream, https://git.kernel.org/pub/scm/bluetooth/bluez.git/commit/?id=5252296b725ef159992be5372f60721bd9adca48
31+---
32+ src/device.c | 38 +++++++++++++++++++++++---------------
33+ 1 file changed, 23 insertions(+), 15 deletions(-)
34+
35+diff --git a/src/device.c b/src/device.c
36+index fb9c0e7..4136425 100644
37+--- a/src/device.c
38++++ b/src/device.c
39+@@ -133,10 +133,15 @@ struct authentication_req {
40+ gboolean secure;
41+ };
42+
43++enum {
44++ BROWSE_SDP,
45++ BROWSE_GATT
46++};
47++
48+ struct browse_req {
49+ DBusMessage *msg;
50+ struct btd_device *device;
51+- uint8_t bdaddr_type;
52++ uint8_t type;
53+ GSList *match_uuids;
54+ GSList *profiles_added;
55+ sdp_list_t *records;
56+@@ -2188,13 +2193,13 @@ static void store_gatt_db(struct btd_device *device)
57+ }
58+
59+
60+-static void browse_request_complete(struct browse_req *req, uint8_t bdaddr_type,
61+- int err)
62++static void browse_request_complete(struct browse_req *req, uint8_t type,
63++ uint8_t bdaddr_type, int err)
64+ {
65+ struct btd_device *dev = req->device;
66+ DBusMessage *reply = NULL;
67+
68+- if (req->bdaddr_type != bdaddr_type)
69++ if (req->type != type)
70+ return;
71+
72+ if (!req->msg)
73+@@ -2248,8 +2253,8 @@ static void device_set_svc_refreshed(struct btd_device *device, bool value)
74+ DEVICE_INTERFACE, "ServicesResolved");
75+ }
76+
77+-static void device_svc_resolved(struct btd_device *dev, uint8_t bdaddr_type,
78+- int err)
79++static void device_svc_resolved(struct btd_device *dev, uint8_t browse_type,
80++ uint8_t bdaddr_type, int err)
81+ {
82+ struct bearer_state *state = get_state(dev, bdaddr_type);
83+ struct browse_req *req = dev->browse;
84+@@ -2296,7 +2301,7 @@ static void device_svc_resolved(struct btd_device *dev, uint8_t bdaddr_type,
85+ if (!req)
86+ return;
87+
88+- browse_request_complete(req, bdaddr_type, err);
89++ browse_request_complete(req, browse_type, bdaddr_type, err);
90+ }
91+
92+ static struct bonding_req *bonding_request_new(DBusMessage *msg,
93+@@ -4564,7 +4569,7 @@ static void search_cb(sdp_list_t *recs, int err, gpointer user_data)
94+ DEVICE_INTERFACE, "UUIDs");
95+
96+ send_reply:
97+- device_svc_resolved(device, BDADDR_BREDR, err);
98++ device_svc_resolved(device, BROWSE_SDP, BDADDR_BREDR, err);
99+ }
100+
101+ static void browse_cb(sdp_list_t *recs, int err, gpointer user_data)
102+@@ -4689,7 +4694,8 @@ static void gatt_client_ready_cb(bool success, uint8_t att_ecode,
103+ DBG("status: %s, error: %u", success ? "success" : "failed", att_ecode);
104+
105+ if (!success) {
106+- device_svc_resolved(device, device->bdaddr_type, -EIO);
107++ device_svc_resolved(device, BROWSE_GATT, device->bdaddr_type,
108++ -EIO);
109+ return;
110+ }
111+
112+@@ -4697,7 +4703,7 @@ static void gatt_client_ready_cb(bool success, uint8_t att_ecode,
113+
114+ btd_gatt_client_ready(device->client_dbus);
115+
116+- device_svc_resolved(device, device->bdaddr_type, 0);
117++ device_svc_resolved(device, BROWSE_GATT, device->bdaddr_type, 0);
118+
119+ store_gatt_db(device);
120+ }
121+@@ -4903,6 +4909,7 @@ static void att_connect_cb(GIOChannel *io, GError *gerr, gpointer user_data)
122+
123+ if (device->browse)
124+ browse_request_complete(device->browse,
125++ BROWSE_GATT,
126+ device->bdaddr_type,
127+ -ECONNABORTED);
128+
129+@@ -5005,7 +5012,7 @@ int device_connect_le(struct btd_device *dev)
130+ }
131+
132+ static struct browse_req *browse_request_new(struct btd_device *device,
133+- uint8_t bdaddr_type,
134++ uint8_t type,
135+ DBusMessage *msg)
136+ {
137+ struct browse_req *req;
138+@@ -5015,7 +5022,7 @@ static struct browse_req *browse_request_new(struct btd_device *device,
139+
140+ req = g_new0(struct browse_req, 1);
141+ req->device = device;
142+- req->bdaddr_type = bdaddr_type;
143++ req->type = type;
144+
145+ device->browse = req;
146+
147+@@ -5041,7 +5048,7 @@ static int device_browse_gatt(struct btd_device *device, DBusMessage *msg)
148+ struct btd_adapter *adapter = device->adapter;
149+ struct browse_req *req;
150+
151+- req = browse_request_new(device, device->bdaddr_type, msg);
152++ req = browse_request_new(device, BROWSE_GATT, msg);
153+ if (!req)
154+ return -EBUSY;
155+
156+@@ -5057,7 +5064,8 @@ static int device_browse_gatt(struct btd_device *device, DBusMessage *msg)
157+ * Services have already been discovered, so signal this browse
158+ * request as resolved.
159+ */
160+- device_svc_resolved(device, device->bdaddr_type, 0);
161++ device_svc_resolved(device, BROWSE_GATT, device->bdaddr_type,
162++ 0);
163+ return 0;
164+ }
165+
166+@@ -5113,7 +5121,7 @@ static int device_browse_sdp(struct btd_device *device, DBusMessage *msg)
167+ uuid_t uuid;
168+ int err;
169+
170+- req = browse_request_new(device, BDADDR_BREDR, msg);
171++ req = browse_request_new(device, BROWSE_SDP, msg);
172+ if (!req)
173+ return -EBUSY;
174+
175+--
176+2.7.4
177+
178diff --git a/debian/patches/series b/debian/patches/series
179index b5ac638..2fdf837 100644
180--- a/debian/patches/series
181+++ b/debian/patches/series
182@@ -12,3 +12,4 @@ migrate_scripts_python3.patch
183
184 # The following patches are submitted upstream and can be
185 # dropped with one of the next releases
186+0001-device-Fix-crash-when-connecting-ATT-with-BR-EDR-onl.patch

Subscribers

People subscribed via source and target branches

to all changes: