All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/2] a2dp: Fix crash when SEP codec has not been initialized
@ 2020-11-23 18:34 Luiz Augusto von Dentz
  2020-11-23 18:34 ` [PATCH BlueZ 2/2] avdtp: Fix not sending GetCapabilities Luiz Augusto von Dentz
  2020-11-23 18:50 ` [BlueZ,1/2] a2dp: Fix crash when SEP codec has not been initialized bluez.test.bot
  0 siblings, 2 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2020-11-23 18:34 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

If SEP has not been properly discovered avdtp_get_codec may return NULL
thus causing crashes such as:

https://github.com/bluez/bluez/issues/57
---
 profiles/audio/a2dp.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index 59d11a0aa..f1e4fa990 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
@@ -1887,8 +1887,8 @@ static void register_remote_sep(void *data, void *user_data)
 				sep, remote_sep_free) == FALSE) {
 		error("Could not register remote sep %s", sep->path);
 		free(sep->path);
-		sep->path = NULL;
-		goto done;
+		free(sep);
+		return;
 	}
 
 	DBG("Found remote SEP: %s", sep->path);
@@ -2627,10 +2627,15 @@ static void store_remote_sep(void *data, void *user_data)
 	GKeyFile *key_file = user_data;
 	char seid[4], value[256];
 	struct avdtp_service_capability *service = avdtp_get_codec(sep->sep);
-	struct avdtp_media_codec_capability *codec = (void *) service->data;
+	struct avdtp_media_codec_capability *codec;
 	unsigned int i;
 	ssize_t offset;
 
+	if (!service)
+		return;
+
+	codec = (void *) service->data;
+
 	sprintf(seid, "%02hhx", avdtp_get_seid(sep->sep));
 
 	offset = sprintf(value, "%02hhx:%02hhx:%02hhx:",
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH BlueZ 2/2] avdtp: Fix not sending GetCapabilities
  2020-11-23 18:34 [PATCH BlueZ 1/2] a2dp: Fix crash when SEP codec has not been initialized Luiz Augusto von Dentz
@ 2020-11-23 18:34 ` Luiz Augusto von Dentz
  2020-11-23 18:50 ` [BlueZ,1/2] a2dp: Fix crash when SEP codec has not been initialized bluez.test.bot
  1 sibling, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2020-11-23 18:34 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

It remote SEP has no codec capabilities it must be read with
GetCapabilities/GetAllCapabilities otherwise we cannot match it with a
local SEP.
---
 profiles/audio/avdtp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
index ff0a124c3..1093a3543 100644
--- a/profiles/audio/avdtp.c
+++ b/profiles/audio/avdtp.c
@@ -2706,7 +2706,8 @@ static gboolean avdtp_discover_resp(struct avdtp *session,
 
 		sep = find_remote_sep(session->seps, resp->seps[i].seid);
 		if (sep && sep->type == resp->seps[i].type &&
-				sep->media_type == resp->seps[i].media_type)
+				sep->media_type == resp->seps[i].media_type &&
+				sep->codec)
 			continue;
 
 		if (resp->seps[i].inuse && !stream)
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [BlueZ,1/2] a2dp: Fix crash when SEP codec has not been initialized
  2020-11-23 18:34 [PATCH BlueZ 1/2] a2dp: Fix crash when SEP codec has not been initialized Luiz Augusto von Dentz
  2020-11-23 18:34 ` [PATCH BlueZ 2/2] avdtp: Fix not sending GetCapabilities Luiz Augusto von Dentz
@ 2020-11-23 18:50 ` bluez.test.bot
  2020-11-24 21:23   ` Luiz Augusto von Dentz
  1 sibling, 1 reply; 4+ messages in thread
From: bluez.test.bot @ 2020-11-23 18:50 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=389671

---Test result---

##############################
Test: CheckPatch - PASS

##############################
Test: CheckGitLint - PASS

##############################
Test: CheckBuild - PASS

##############################
Test: MakeCheck - PASS



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BlueZ,1/2] a2dp: Fix crash when SEP codec has not been initialized
  2020-11-23 18:50 ` [BlueZ,1/2] a2dp: Fix crash when SEP codec has not been initialized bluez.test.bot
@ 2020-11-24 21:23   ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2020-11-24 21:23 UTC (permalink / raw)
  To: linux-bluetooth

Hi,

On Mon, Nov 23, 2020 at 10:50 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=389671
>
> ---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] 4+ messages in thread

end of thread, other threads:[~2020-11-24 21:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-23 18:34 [PATCH BlueZ 1/2] a2dp: Fix crash when SEP codec has not been initialized Luiz Augusto von Dentz
2020-11-23 18:34 ` [PATCH BlueZ 2/2] avdtp: Fix not sending GetCapabilities Luiz Augusto von Dentz
2020-11-23 18:50 ` [BlueZ,1/2] a2dp: Fix crash when SEP codec has not been initialized bluez.test.bot
2020-11-24 21:23   ` 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.