All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ] a2dp: Fix crash when SEP codec has not been initialized
@ 2022-03-28 20:36 Luiz Augusto von Dentz
  2022-03-28 22:06 ` [BlueZ] " bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2022-03-28 20:36 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 when running AVRCP/TG/VLH/BI-01-C after
AVRCP/TG/RCR/BV-04-C
---
 profiles/audio/a2dp.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index c3ac432a7..52a21357b 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
@@ -2074,6 +2074,11 @@ static struct a2dp_remote_sep *register_remote_sep(void *data, void *user_data)
 	if (sep)
 		return sep;
 
+	if (avdtp_get_codec(rsep)) {
+		error("Unable to get remote sep codec");
+		return NULL;
+	}
+
 	sep = new0(struct a2dp_remote_sep, 1);
 	sep->chan = chan;
 	sep->sep = rsep;
@@ -2206,8 +2211,14 @@ static void load_remote_sep(struct a2dp_channel *chan, GKeyFile *key_file,
 		}
 
 		sep = register_remote_sep(rsep, chan);
-		if (sep)
-			sep->from_cache = true;
+		if (!sep) {
+			avdtp_unregister_remote_sep(chan->session, rsep);
+			/* Update cache */
+			store_remote_seps(chan);
+			continue;
+		}
+
+		sep->from_cache = true;
 	}
 
 	value = g_key_file_get_string(key_file, "Endpoints", "LastUsed", NULL);
-- 
2.35.1


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

* RE: [BlueZ] a2dp: Fix crash when SEP codec has not been initialized
  2022-03-28 20:36 [PATCH BlueZ] a2dp: Fix crash when SEP codec has not been initialized Luiz Augusto von Dentz
@ 2022-03-28 22:06 ` bluez.test.bot
  0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2022-03-28 22:06 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

[-- Attachment #1: Type: text/plain, Size: 997 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=626995

---Test result---

Test Summary:
CheckPatch                    PASS      1.52 seconds
GitLint                       PASS      0.97 seconds
Prep - Setup ELL              PASS      57.14 seconds
Build - Prep                  PASS      0.91 seconds
Build - Configure             PASS      11.52 seconds
Build - Make                  PASS      1949.57 seconds
Make Check                    PASS      12.99 seconds
Make Check w/Valgrind         PASS      592.63 seconds
Make Distcheck                PASS      313.99 seconds
Build w/ext ELL - Configure   PASS      12.12 seconds
Build w/ext ELL - Make        PASS      1927.87 seconds
Incremental Build with patchesPASS      0.00 seconds



---
Regards,
Linux Bluetooth


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

end of thread, other threads:[~2022-03-28 22:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-28 20:36 [PATCH BlueZ] a2dp: Fix crash when SEP codec has not been initialized Luiz Augusto von Dentz
2022-03-28 22:06 ` [BlueZ] " bluez.test.bot

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.