* [PATCH BlueZ 1/2] adapter: Fix adding SDP records when operating on LE only mode
@ 2022-03-24 21:36 Luiz Augusto von Dentz
2022-03-24 21:36 ` [PATCH BlueZ 2/2] a2dp: Don't initialize a2dp_sep->destroy until properly registered Luiz Augusto von Dentz
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2022-03-24 21:36 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
If mode is set to BT_MODE_LE SDP protocol won't be operational so it is
useless to attempt to add records.
---
src/adapter.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/adapter.c b/src/adapter.c
index 1fcf75ec4..e8b84ccda 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1227,6 +1227,13 @@ int adapter_service_add(struct btd_adapter *adapter, sdp_record_t *rec)
{
int ret;
+ /*
+ * If the controller does not support BR/EDR operation,
+ * there is no point in trying to add SDP records.
+ */
+ if (btd_opts.mode == BT_MODE_LE)
+ return -ENOTSUP;
+
DBG("%s", adapter->path);
ret = add_record_to_server(&adapter->bdaddr, rec);
@@ -1240,10 +1247,17 @@ int adapter_service_add(struct btd_adapter *adapter, sdp_record_t *rec)
void adapter_service_remove(struct btd_adapter *adapter, uint32_t handle)
{
- sdp_record_t *rec = sdp_record_find(handle);
+ sdp_record_t *rec;
+ /*
+ * If the controller does not support BR/EDR operation,
+ * there is no point in trying to remote SDP records.
+ */
+ if (btd_opts.mode == BT_MODE_LE)
+ return;
DBG("%s", adapter->path);
+ rec = sdp_record_find(handle);
if (!rec)
return;
--
2.35.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH BlueZ 2/2] a2dp: Don't initialize a2dp_sep->destroy until properly registered
2022-03-24 21:36 [PATCH BlueZ 1/2] adapter: Fix adding SDP records when operating on LE only mode Luiz Augusto von Dentz
@ 2022-03-24 21:36 ` Luiz Augusto von Dentz
2022-03-24 23:25 ` [BlueZ,1/2] adapter: Fix adding SDP records when operating on LE only mode bluez.test.bot
2022-03-28 18:00 ` [PATCH BlueZ 1/2] " patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2022-03-24 21:36 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
On a2dp_add_sep if the record cannot be properly registred
a2dp_unregister_sep would be called which would attempt to destroy the
user_data causing the following backtrace:
Invalid write of size 8
at 0x2F41EB: endpoint_init_a2dp_source (media.c:687)
by 0x2F41EB: media_endpoint_create (media.c:1030)
by 0x2F6713: register_endpoint (media.c:1155)
by 0x46983F: process_message (object.c:246)
by 0x4A574A8: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.19.14)
by 0x45F0BF: message_dispatch (mainloop.c:59)
by 0x495239A: ??? (in /usr/lib64/libglib-2.0.so.0.7000.4)
by 0x495605E: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.7000.4)
by 0x49AB2A7: ??? (in /usr/lib64/libglib-2.0.so.0.7000.4)
by 0x4955772: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.7000.4)
by 0x4CA924: mainloop_run (mainloop-glib.c:66)
by 0x4CAE1B: mainloop_run_with_signal (mainloop-notify.c:188)
by 0x2AE791: main (main.c:1258)
Address 0x6e47a30 is 0 bytes inside a block of size 112 free'd
at 0x48470E4: free (vg_replace_malloc.c:872)
by 0x4957CDC: g_free (in /usr/lib64/libglib-2.0.so.0.7000.4)
by 0x2C2D57: a2dp_unregister_sep (a2dp.c:2588)
by 0x2D124C: a2dp_add_sep (a2dp.c:2697)
by 0x2F41D5: endpoint_init_a2dp_source (media.c:687)
by 0x2F41D5: media_endpoint_create (media.c:1030)
by 0x2F6713: register_endpoint (media.c:1155)
by 0x46983F: process_message (object.c:246)
by 0x4A574A8: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.19.14)
by 0x45F0BF: message_dispatch (mainloop.c:59)
by 0x495239A: ??? (in /usr/lib64/libglib-2.0.so.0.7000.4)
by 0x495605E: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.7000.4)
by 0x49AB2A7: ??? (in /usr/lib64/libglib-2.0.so.0.7000.4)
---
profiles/audio/a2dp.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index f761dbe54..d66c22b2b 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
@@ -2668,8 +2668,6 @@ struct a2dp_sep *a2dp_add_sep(struct btd_adapter *adapter, uint8_t type,
sep->codec = codec;
sep->type = type;
sep->delay_reporting = delay_reporting;
- sep->user_data = user_data;
- sep->destroy = destroy;
if (type == AVDTP_SEP_TYPE_SOURCE) {
l = &server->sources;
@@ -2713,6 +2711,9 @@ struct a2dp_sep *a2dp_add_sep(struct btd_adapter *adapter, uint8_t type,
add:
*l = g_slist_append(*l, sep);
+ sep->user_data = user_data;
+ sep->destroy = destroy;
+
if (err)
*err = 0;
return sep;
--
2.35.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [BlueZ,1/2] adapter: Fix adding SDP records when operating on LE only mode
2022-03-24 21:36 [PATCH BlueZ 1/2] adapter: Fix adding SDP records when operating on LE only mode Luiz Augusto von Dentz
2022-03-24 21:36 ` [PATCH BlueZ 2/2] a2dp: Don't initialize a2dp_sep->destroy until properly registered Luiz Augusto von Dentz
@ 2022-03-24 23:25 ` bluez.test.bot
2022-03-28 18:00 ` [PATCH BlueZ 1/2] " patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2022-03-24 23:25 UTC (permalink / raw)
To: linux-bluetooth, luiz.dentz
[-- Attachment #1: Type: text/plain, Size: 1995 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=626167
---Test result---
Test Summary:
CheckPatch FAIL 2.83 seconds
GitLint PASS 1.96 seconds
Prep - Setup ELL PASS 39.94 seconds
Build - Prep PASS 0.74 seconds
Build - Configure PASS 7.92 seconds
Build - Make PASS 1322.38 seconds
Make Check PASS 11.75 seconds
Make Check w/Valgrind PASS 407.79 seconds
Make Distcheck PASS 215.81 seconds
Build w/ext ELL - Configure PASS 8.41 seconds
Build w/ext ELL - Make PASS 1371.63 seconds
Incremental Build with patchesPASS 2697.11 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script with rule in .checkpatch.conf
Output:
[BlueZ,2/2] a2dp: Don't initialize a2dp_sep->destroy until properly registered
WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#93:
by 0x4A574A8: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.19.14)
/github/workspace/src/12791043.patch total: 0 errors, 1 warnings, 17 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/12791043.patch has style problems, please review.
NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH BlueZ 1/2] adapter: Fix adding SDP records when operating on LE only mode
2022-03-24 21:36 [PATCH BlueZ 1/2] adapter: Fix adding SDP records when operating on LE only mode Luiz Augusto von Dentz
2022-03-24 21:36 ` [PATCH BlueZ 2/2] a2dp: Don't initialize a2dp_sep->destroy until properly registered Luiz Augusto von Dentz
2022-03-24 23:25 ` [BlueZ,1/2] adapter: Fix adding SDP records when operating on LE only mode bluez.test.bot
@ 2022-03-28 18:00 ` patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2022-03-28 18:00 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
Hello:
This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Thu, 24 Mar 2022 14:36:57 -0700 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> If mode is set to BT_MODE_LE SDP protocol won't be operational so it is
> useless to attempt to add records.
> ---
> src/adapter.c | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
Here is the summary with links:
- [BlueZ,1/2] adapter: Fix adding SDP records when operating on LE only mode
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=4fefa24097e4
- [BlueZ,2/2] a2dp: Don't initialize a2dp_sep->destroy until properly registered
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=18fc3abad28c
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-03-28 18:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-24 21:36 [PATCH BlueZ 1/2] adapter: Fix adding SDP records when operating on LE only mode Luiz Augusto von Dentz
2022-03-24 21:36 ` [PATCH BlueZ 2/2] a2dp: Don't initialize a2dp_sep->destroy until properly registered Luiz Augusto von Dentz
2022-03-24 23:25 ` [BlueZ,1/2] adapter: Fix adding SDP records when operating on LE only mode bluez.test.bot
2022-03-28 18:00 ` [PATCH BlueZ 1/2] " patchwork-bot+bluetooth
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.