* [PATCH BlueZ] a2dp: Fix crash if setup is freed while reconfiguring
@ 2020-11-30 19:17 Luiz Augusto von Dentz
2020-11-30 19:28 ` [BlueZ] " bluez.test.bot
0 siblings, 1 reply; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2020-11-30 19:17 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This fixes the crash reported on:
https://github.com/bluez/bluez/issues/60
---
profiles/audio/a2dp.c | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index f1e4fa990..a333276e0 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
@@ -105,6 +105,7 @@ struct a2dp_setup {
gboolean start;
GSList *cb;
GIOChannel *io;
+ guint id;
int ref;
};
@@ -207,6 +208,9 @@ static void setup_free(struct a2dp_setup *s)
g_io_channel_unref(s->io);
}
+ if (s->id)
+ g_source_remove(s->id);
+
queue_destroy(s->eps, NULL);
setups = g_slist_remove(setups, s);
@@ -1166,6 +1170,8 @@ static gboolean a2dp_reconfigure(gpointer data)
struct avdtp_media_codec_capability *rsep_codec;
struct avdtp_service_capability *cap;
+ setup->id = 0;
+
if (!sep->lsep) {
error("no valid local SEP");
posix_err = -EINVAL;
@@ -1202,6 +1208,20 @@ failed:
return FALSE;
}
+static bool setup_reconfigure(struct a2dp_setup *setup)
+{
+ if (!setup->reconfigure || setup->id)
+ return false;
+
+ DBG("%p", setup);
+
+ setup->id = g_timeout_add(RECONFIGURE_TIMEOUT, a2dp_reconfigure, setup);
+
+ setup->reconfigure = FALSE;
+
+ return true;
+}
+
static struct a2dp_remote_sep *get_remote_sep(struct a2dp_channel *chan,
struct avdtp_stream *stream)
{
@@ -1238,8 +1258,7 @@ static void close_cfm(struct avdtp *session, struct avdtp_local_sep *sep,
if (!setup->rsep)
setup->rsep = get_remote_sep(setup->chan, stream);
- if (setup->reconfigure)
- g_timeout_add(RECONFIGURE_TIMEOUT, a2dp_reconfigure, setup);
+ setup_reconfigure(setup);
}
static void abort_ind(struct avdtp *session, struct avdtp_local_sep *sep,
@@ -1283,10 +1302,8 @@ static void abort_cfm(struct avdtp *session, struct avdtp_local_sep *sep,
if (!setup)
return;
- if (setup->reconfigure) {
- g_timeout_add(RECONFIGURE_TIMEOUT, a2dp_reconfigure, setup);
+ if (setup_reconfigure(setup))
return;
- }
setup_unref(setup);
}
--
2.26.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [BlueZ] a2dp: Fix crash if setup is freed while reconfiguring
2020-11-30 19:17 [PATCH BlueZ] a2dp: Fix crash if setup is freed while reconfiguring Luiz Augusto von Dentz
@ 2020-11-30 19:28 ` bluez.test.bot
2020-12-01 0:28 ` Luiz Augusto von Dentz
0 siblings, 1 reply; 3+ messages in thread
From: bluez.test.bot @ 2020-11-30 19:28 UTC (permalink / raw)
To: linux-bluetooth, luiz.dentz
[-- Attachment #1: Type: text/plain, Size: 557 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=393495
---Test result---
##############################
Test: CheckPatch - PASS
##############################
Test: CheckGitLint - PASS
##############################
Test: CheckBuild - PASS
##############################
Test: MakeCheck - PASS
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [BlueZ] a2dp: Fix crash if setup is freed while reconfiguring
2020-11-30 19:28 ` [BlueZ] " bluez.test.bot
@ 2020-12-01 0:28 ` Luiz Augusto von Dentz
0 siblings, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2020-12-01 0:28 UTC (permalink / raw)
To: linux-bluetooth@vger.kernel.org
Hi,
On Mon, Nov 30, 2020 at 11:28 AM <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=393495
>
> ---Test result---
>
> ##############################
> Test: CheckPatch - PASS
>
> ##############################
> Test: CheckGitLint - PASS
>
> ##############################
> Test: CheckBuild - PASS
>
> ##############################
> Test: MakeCheck - PASS
>
>
>
> ---
> Regards,
> Linux Bluetooth
Pushed.
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-12-01 0:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-30 19:17 [PATCH BlueZ] a2dp: Fix crash if setup is freed while reconfiguring Luiz Augusto von Dentz
2020-11-30 19:28 ` [BlueZ] " bluez.test.bot
2020-12-01 0:28 ` Luiz Augusto von Dentz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox