summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/bluez5/bluez5/CVE-2021-3658.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-connectivity/bluez5/bluez5/CVE-2021-3658.patch')
-rw-r--r--meta/recipes-connectivity/bluez5/bluez5/CVE-2021-3658.patch95
1 files changed, 95 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/bluez5/bluez5/CVE-2021-3658.patch b/meta/recipes-connectivity/bluez5/bluez5/CVE-2021-3658.patch
new file mode 100644
index 0000000000..1738ca13da
--- /dev/null
+++ b/meta/recipes-connectivity/bluez5/bluez5/CVE-2021-3658.patch
@@ -0,0 +1,95 @@
1From b497b5942a8beb8f89ca1c359c54ad67ec843055 Mon Sep 17 00:00:00 2001
2From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
3Date: Thu, 24 Jun 2021 16:32:04 -0700
4Subject: [PATCH] adapter: Fix storing discoverable setting
5
6discoverable setting shall only be store when changed via Discoverable
7property and not when discovery client set it as that be considered
8temporary just for the lifetime of the discovery.
9
10Upstream-Status: Backport [https://github.com/bluez/bluez/commit/b497b5942a8beb8f89ca1c359c54ad67ec843055]
11Signed-off-by:Minjae Kim <flowergom@gmail.com>
12---
13 src/adapter.c | 35 ++++++++++++++++++++++-------------
14 1 file changed, 22 insertions(+), 13 deletions(-)
15
16diff --git a/src/adapter.c b/src/adapter.c
17index 12e4ff5c0..663b778e4 100644
18--- a/src/adapter.c
19+++ b/src/adapter.c
20@@ -560,7 +560,11 @@ static void settings_changed(struct btd_adapter *adapter, uint32_t settings)
21 if (changed_mask & MGMT_SETTING_DISCOVERABLE) {
22 g_dbus_emit_property_changed(dbus_conn, adapter->path,
23 ADAPTER_INTERFACE, "Discoverable");
24- store_adapter_info(adapter);
25+ /* Only persist discoverable setting if it was not set
26+ * temporarily by discovery.
27+ */
28+ if (!adapter->discovery_discoverable)
29+ store_adapter_info(adapter);
30 btd_adv_manager_refresh(adapter->adv_manager);
31 }
32
33@@ -2162,8 +2166,6 @@ static bool filters_equal(struct mgmt_cp_start_service_discovery *a,
34 static int update_discovery_filter(struct btd_adapter *adapter)
35 {
36 struct mgmt_cp_start_service_discovery *sd_cp;
37- GSList *l;
38-
39
40 DBG("");
41
42@@ -2173,17 +2175,24 @@ static int update_discovery_filter(struct btd_adapter *adapter)
43 return -ENOMEM;
44 }
45
46- for (l = adapter->discovery_list; l; l = g_slist_next(l)) {
47- struct discovery_client *client = l->data;
48+ /* Only attempt to overwrite current discoverable setting when not
49+ * discoverable.
50+ */
51+ if (!(adapter->current_settings & MGMT_OP_SET_DISCOVERABLE)) {
52+ GSList *l;
53
54- if (!client->discovery_filter)
55- continue;
56+ for (l = adapter->discovery_list; l; l = g_slist_next(l)) {
57+ struct discovery_client *client = l->data;
58
59- if (client->discovery_filter->discoverable)
60- break;
61- }
62+ if (!client->discovery_filter)
63+ continue;
64
65- set_discovery_discoverable(adapter, l ? true : false);
66+ if (client->discovery_filter->discoverable) {
67+ set_discovery_discoverable(adapter, true);
68+ break;
69+ }
70+ }
71+ }
72
73 /*
74 * If filters are equal, then don't update scan, except for when
75@@ -2216,8 +2225,7 @@ static int discovery_stop(struct discovery_client *client)
76 return 0;
77 }
78
79- if (adapter->discovery_discoverable)
80- set_discovery_discoverable(adapter, false);
81+ set_discovery_discoverable(adapter, false);
82
83 /*
84 * In the idle phase of a discovery, there is no need to stop it
85@@ -6913,6 +6921,7 @@ static void adapter_stop(struct btd_adapter *adapter)
86 g_free(adapter->current_discovery_filter);
87 adapter->current_discovery_filter = NULL;
88
89+ set_discovery_discoverable(adapter, false);
90 adapter->discovering = false;
91
92 while (adapter->connections) {
93--
942.25.1
95