diff options
author | Minjae Kim <flowergom@gmail.com> | 2022-03-19 23:40:52 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-03-23 23:16:12 +0000 |
commit | 8b369ca021c212d36ec115c0b5e4596ae2c13543 (patch) | |
tree | 14f919a3a31fc97e4f9907c0bb6d93d73c11ffe1 /meta/recipes-connectivity/bluez5/bluez5/CVE-2021-3658.patch | |
parent | 094a9a9a236ed1cb6b53f1326f6ec702ee354f48 (diff) | |
download | poky-8b369ca021c212d36ec115c0b5e4596ae2c13543.tar.gz |
bluez5: fix CVE-2021-3658
adapter incorrectly restores Discoverable state after powered down
Upstream-Status: Backport [https://github.com/bluez/bluez/commit/b497b5942a8beb8f89ca1c359c54ad67ec843055]
CVE: CVE-2021-3658
(From OE-Core rev: 12669ab256a3ffbcb4bcbaba1bc9c690920d32b1)
Signed-off-by:Minjae Kim <flowergom@gmail.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-connectivity/bluez5/bluez5/CVE-2021-3658.patch')
-rw-r--r-- | meta/recipes-connectivity/bluez5/bluez5/CVE-2021-3658.patch | 95 |
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 @@ | |||
1 | From b497b5942a8beb8f89ca1c359c54ad67ec843055 Mon Sep 17 00:00:00 2001 | ||
2 | From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | ||
3 | Date: Thu, 24 Jun 2021 16:32:04 -0700 | ||
4 | Subject: [PATCH] adapter: Fix storing discoverable setting | ||
5 | |||
6 | discoverable setting shall only be store when changed via Discoverable | ||
7 | property and not when discovery client set it as that be considered | ||
8 | temporary just for the lifetime of the discovery. | ||
9 | |||
10 | Upstream-Status: Backport [https://github.com/bluez/bluez/commit/b497b5942a8beb8f89ca1c359c54ad67ec843055] | ||
11 | Signed-off-by:Minjae Kim <flowergom@gmail.com> | ||
12 | --- | ||
13 | src/adapter.c | 35 ++++++++++++++++++++++------------- | ||
14 | 1 file changed, 22 insertions(+), 13 deletions(-) | ||
15 | |||
16 | diff --git a/src/adapter.c b/src/adapter.c | ||
17 | index 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 | -- | ||
94 | 2.25.1 | ||
95 | |||