* [PATCH BlueZ 1/2] adapter: Fix crash when storing link key
@ 2022-02-10 0:09 Luiz Augusto von Dentz
2022-02-10 0:09 ` [PATCH BlueZ 2/2] uuid: Fix crashing if a NULL string is passed to bt_string_to_uuid Luiz Augusto von Dentz
2022-02-10 3:09 ` [BlueZ,1/2] adapter: Fix crash when storing link key bluez.test.bot
0 siblings, 2 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2022-02-10 0:09 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
The following trace can be observed sometimes when pairing 2 emulator
instances:
src/adapter.c:store_link_key() Unable to load key file from
/var/lib/bluetooth/9C:DA:3E:F2:8E:46/9C:B6:D0:8A:A0:0C/info: (No
such file or directory)
GLib: g_file_set_contents: assertion 'error == NULL ||
*error == NULL' failed
++++++++ backtrace ++++++++
#1 btd_backtrace+0x28a (src/backtrace.c:59) [0x7f65bb5ab53a]
#2 g_logv+0x21c (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6400.6)
[0x7f65ba3f955c]
#3 g_log+0x93 (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6400.6)
[0x7f65ba3f9743]
#4 g_file_set_contents+0x68
(/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6400.6) [0x7f65ba3dca68]
#5 store_link_key+0x30a (src/adapter.c:8235) [0x7f65bb61839a]
#6 new_link_key_callback+0x474 (src/adapter.c:8285) [0x7f65bb62c904]
#7 queue_foreach+0x164 (src/shared/queue.c:203) [0x7f65bb722e34]
#8 can_read_data+0x59f (src/shared/mgmt.c:343) [0x7f65bb72e09f]
#9 watch_callback+0x112 (src/shared/io-glib.c:162) [0x7f65bb78acb2]
#10 g_main_context_dispatch+0x14e
(/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6400.6) [0x7f65ba3f204e]
---
src/adapter.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index a6dcc76de..3ee98431d 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -8214,11 +8214,15 @@ static void store_link_key(struct btd_adapter *adapter,
snprintf(filename, PATH_MAX, STORAGEDIR "/%s/%s/info",
btd_adapter_get_storage_dir(adapter), device_addr);
+ create_file(filename, 0600);
+
key_file = g_key_file_new();
if (!g_key_file_load_from_file(key_file, filename, 0, &gerr)) {
error("Unable to load key file from %s: (%s)", filename,
gerr->message);
g_error_free(gerr);
+ g_key_file_free(key_file);
+ return;
}
for (i = 0; i < 16; i++)
@@ -8229,8 +8233,6 @@ static void store_link_key(struct btd_adapter *adapter,
g_key_file_set_integer(key_file, "LinkKey", "Type", type);
g_key_file_set_integer(key_file, "LinkKey", "PINLength", pin_length);
- create_file(filename, 0600);
-
str = g_key_file_to_data(key_file, &length, NULL);
if (!g_file_set_contents(filename, str, length, &gerr)) {
error("Unable set contents for %s: (%s)", filename,
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH BlueZ 2/2] uuid: Fix crashing if a NULL string is passed to bt_string_to_uuid
2022-02-10 0:09 [PATCH BlueZ 1/2] adapter: Fix crash when storing link key Luiz Augusto von Dentz
@ 2022-02-10 0:09 ` Luiz Augusto von Dentz
2022-02-10 3:09 ` [BlueZ,1/2] adapter: Fix crash when storing link key bluez.test.bot
1 sibling, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2022-02-10 0:09 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
bt_string_to_uuid shall chack if the string is valid before attempting
to access its contents.
---
lib/uuid.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/uuid.c b/lib/uuid.c
index 3d97dc835..1d2e1f732 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -251,6 +251,9 @@ static int bt_string_to_uuid128(bt_uuid_t *uuid, const char *string)
int bt_string_to_uuid(bt_uuid_t *uuid, const char *string)
{
+ if (!string)
+ return -EINVAL;
+
if (is_base_uuid128(string))
return bt_string_to_uuid16(uuid, string + 4);
else if (is_uuid128(string))
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [BlueZ,1/2] adapter: Fix crash when storing link key
2022-02-10 0:09 [PATCH BlueZ 1/2] adapter: Fix crash when storing link key Luiz Augusto von Dentz
2022-02-10 0:09 ` [PATCH BlueZ 2/2] uuid: Fix crashing if a NULL string is passed to bt_string_to_uuid Luiz Augusto von Dentz
@ 2022-02-10 3:09 ` bluez.test.bot
2022-02-10 22:30 ` Luiz Augusto von Dentz
1 sibling, 1 reply; 4+ messages in thread
From: bluez.test.bot @ 2022-02-10 3:09 UTC (permalink / raw)
To: linux-bluetooth, luiz.dentz
[-- Attachment #1: Type: text/plain, Size: 995 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=612844
---Test result---
Test Summary:
CheckPatch PASS 2.80 seconds
GitLint PASS 1.95 seconds
Prep - Setup ELL PASS 42.04 seconds
Build - Prep PASS 0.71 seconds
Build - Configure PASS 8.25 seconds
Build - Make PASS 1316.49 seconds
Make Check PASS 11.14 seconds
Make Check w/Valgrind PASS 419.52 seconds
Make Distcheck PASS 214.99 seconds
Build w/ext ELL - Configure PASS 8.17 seconds
Build w/ext ELL - Make PASS 1270.52 seconds
Incremental Build with patchesPASS 0.00 seconds
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [BlueZ,1/2] adapter: Fix crash when storing link key
2022-02-10 3:09 ` [BlueZ,1/2] adapter: Fix crash when storing link key bluez.test.bot
@ 2022-02-10 22:30 ` Luiz Augusto von Dentz
0 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2022-02-10 22:30 UTC (permalink / raw)
To: linux-bluetooth
Hi,
On Wed, Feb 9, 2022 at 7:09 PM <bluez.test.bot@gmail.com> wrote:
>
> This is automated email and please do not reply to this email!
>
> Dear submitter,
>
> Thank you for submitting the patches to the linux bluetooth mailing list.
> This is a CI test results with your patch series:
> PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=612844
>
> ---Test result---
>
> Test Summary:
> CheckPatch PASS 2.80 seconds
> GitLint PASS 1.95 seconds
> Prep - Setup ELL PASS 42.04 seconds
> Build - Prep PASS 0.71 seconds
> Build - Configure PASS 8.25 seconds
> Build - Make PASS 1316.49 seconds
> Make Check PASS 11.14 seconds
> Make Check w/Valgrind PASS 419.52 seconds
> Make Distcheck PASS 214.99 seconds
> Build w/ext ELL - Configure PASS 8.17 seconds
> Build w/ext ELL - Make PASS 1270.52 seconds
> Incremental Build with patchesPASS 0.00 seconds
>
>
>
> ---
> Regards,
> Linux Bluetooth
>
Pushed.
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-02-10 22:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-10 0:09 [PATCH BlueZ 1/2] adapter: Fix crash when storing link key Luiz Augusto von Dentz
2022-02-10 0:09 ` [PATCH BlueZ 2/2] uuid: Fix crashing if a NULL string is passed to bt_string_to_uuid Luiz Augusto von Dentz
2022-02-10 3:09 ` [BlueZ,1/2] adapter: Fix crash when storing link key bluez.test.bot
2022-02-10 22:30 ` Luiz Augusto von Dentz
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.