summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrevor Gamblin <trevor.gamblin@windriver.com>2021-09-01 14:45:45 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-09-09 10:19:42 +0100
commit22f2aee79d798980f58b042aa584fa6b94f4952c (patch)
tree4105bf0f07aa72560627a7500772c018f2ac9440
parent6e2b2ab438e08a080d85a2ef24e5ea1f16390204 (diff)
downloadpoky-22f2aee79d798980f58b042aa584fa6b94f4952c.tar.gz
bluez5: fix CVE-2021-3658
Backporting upstream fix since the uprev from 5.60 -> 5.61 does include some minor functionality changes. (From OE-Core rev: 0559cba2b46883e2d0178d611b164814a989df37) Signed-off-by: Trevor Gamblin <trevor.gamblin@windriver.com> Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-connectivity/bluez5/bluez5.inc1
-rw-r--r--meta/recipes-connectivity/bluez5/bluez5/0001-adapter-Fix-storing-discoverable-setting.patch100
2 files changed, 101 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/bluez5/bluez5.inc b/meta/recipes-connectivity/bluez5/bluez5.inc
index a7b628ce1b..0d30b1a3f5 100644
--- a/meta/recipes-connectivity/bluez5/bluez5.inc
+++ b/meta/recipes-connectivity/bluez5/bluez5.inc
@@ -52,6 +52,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/bluetooth/bluez-${PV}.tar.xz \
52 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'file://0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch', d)} \ 52 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'file://0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch', d)} \
53 file://0001-tests-add-a-target-for-building-tests-without-runnin.patch \ 53 file://0001-tests-add-a-target-for-building-tests-without-runnin.patch \
54 file://0001-test-gatt-Fix-hung-issue.patch \ 54 file://0001-test-gatt-Fix-hung-issue.patch \
55 file://0001-adapter-Fix-storing-discoverable-setting.patch \
55 " 56 "
56S = "${WORKDIR}/bluez-${PV}" 57S = "${WORKDIR}/bluez-${PV}"
57 58
diff --git a/meta/recipes-connectivity/bluez5/bluez5/0001-adapter-Fix-storing-discoverable-setting.patch b/meta/recipes-connectivity/bluez5/bluez5/0001-adapter-Fix-storing-discoverable-setting.patch
new file mode 100644
index 0000000000..c2a5edd226
--- /dev/null
+++ b/meta/recipes-connectivity/bluez5/bluez5/0001-adapter-Fix-storing-discoverable-setting.patch
@@ -0,0 +1,100 @@
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
11(https://git.kernel.org/pub/scm/bluetooth/bluez.git/commit/?id=b497b5942a8beb8f89ca1c359c54ad67ec843055)
12
13CVE: CVE-2021-3658
14
15Signed-off-by: Trevor Gamblin <trevor.gamblin@windriver.com>
16
17---
18 src/adapter.c | 35 ++++++++++++++++++++++-------------
19 1 file changed, 22 insertions(+), 13 deletions(-)
20
21diff --git a/src/adapter.c b/src/adapter.c
22index 12e4ff5c0..663b778e4 100644
23--- a/src/adapter.c
24+++ b/src/adapter.c
25@@ -560,7 +560,11 @@ static void settings_changed(struct btd_adapter *adapter, uint32_t settings)
26 if (changed_mask & MGMT_SETTING_DISCOVERABLE) {
27 g_dbus_emit_property_changed(dbus_conn, adapter->path,
28 ADAPTER_INTERFACE, "Discoverable");
29- store_adapter_info(adapter);
30+ /* Only persist discoverable setting if it was not set
31+ * temporarily by discovery.
32+ */
33+ if (!adapter->discovery_discoverable)
34+ store_adapter_info(adapter);
35 btd_adv_manager_refresh(adapter->adv_manager);
36 }
37
38@@ -2162,8 +2166,6 @@ static bool filters_equal(struct mgmt_cp_start_service_discovery *a,
39 static int update_discovery_filter(struct btd_adapter *adapter)
40 {
41 struct mgmt_cp_start_service_discovery *sd_cp;
42- GSList *l;
43-
44
45 DBG("");
46
47@@ -2173,17 +2175,24 @@ static int update_discovery_filter(struct btd_adapter *adapter)
48 return -ENOMEM;
49 }
50
51- for (l = adapter->discovery_list; l; l = g_slist_next(l)) {
52- struct discovery_client *client = l->data;
53+ /* Only attempt to overwrite current discoverable setting when not
54+ * discoverable.
55+ */
56+ if (!(adapter->current_settings & MGMT_OP_SET_DISCOVERABLE)) {
57+ GSList *l;
58
59- if (!client->discovery_filter)
60- continue;
61+ for (l = adapter->discovery_list; l; l = g_slist_next(l)) {
62+ struct discovery_client *client = l->data;
63
64- if (client->discovery_filter->discoverable)
65- break;
66- }
67+ if (!client->discovery_filter)
68+ continue;
69
70- set_discovery_discoverable(adapter, l ? true : false);
71+ if (client->discovery_filter->discoverable) {
72+ set_discovery_discoverable(adapter, true);
73+ break;
74+ }
75+ }
76+ }
77
78 /*
79 * If filters are equal, then don't update scan, except for when
80@@ -2216,8 +2225,7 @@ static int discovery_stop(struct discovery_client *client)
81 return 0;
82 }
83
84- if (adapter->discovery_discoverable)
85- set_discovery_discoverable(adapter, false);
86+ set_discovery_discoverable(adapter, false);
87
88 /*
89 * In the idle phase of a discovery, there is no need to stop it
90@@ -6913,6 +6921,7 @@ static void adapter_stop(struct btd_adapter *adapter)
91 g_free(adapter->current_discovery_filter);
92 adapter->current_discovery_filter = NULL;
93
94+ set_discovery_discoverable(adapter, false);
95 adapter->discovering = false;
96
97 while (adapter->connections) {
98--
992.33.0
100