[PATCH BlueZ 1/2] avctp: Fix not handling when kernel has ERTM disabled
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Date: 2021-09-24 21:18:29
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Luiz Augusto von Dentz <redacted> If kernel module is loaded with disable_ertm ERTM won't be available thus browsing channel won't be able to be created, but it shall be possible to still use AVRCP without it. Fixes: https://github.com/bluez/bluez/issues/209 --- profiles/audio/avctp.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/profiles/audio/avctp.c b/profiles/audio/avctp.c
index 702ded136..81320de1b 100644
--- a/profiles/audio/avctp.c
+++ b/profiles/audio/avctp.c@@ -1651,15 +1651,6 @@ int avctp_register(struct btd_adapter *adapter, gboolean central) } server->browsing_io = avctp_server_socket(src, central, BT_IO_MODE_ERTM, AVCTP_BROWSING_PSM); - if (!server->browsing_io) { - if (server->control_io) { - g_io_channel_shutdown(server->control_io, TRUE, NULL); - g_io_channel_unref(server->control_io); - server->control_io = NULL; - } - g_free(server); - return -1; - } server->adapter = btd_adapter_ref(adapter);
@@ -1681,9 +1672,11 @@ void avctp_unregister(struct btd_adapter *adapter) servers = g_slist_remove(servers, server); - g_io_channel_shutdown(server->browsing_io, TRUE, NULL); - g_io_channel_unref(server->browsing_io); - server->browsing_io = NULL; + if (server->browsing_io) { + g_io_channel_shutdown(server->browsing_io, TRUE, NULL); + g_io_channel_unref(server->browsing_io); + server->browsing_io = NULL; + } g_io_channel_shutdown(server->control_io, TRUE, NULL); g_io_channel_unref(server->control_io);
--
2.31.1