a2dp: Fix crash on transport_cb
Luiz Augusto von Dentz
maintainerPATCH 1/1 a2dp: Fix crash on transport_cb
From: Luiz Augusto von Dentz <[email protected]>
There have been reports of crashes on transport_cb where the setup would most likely already have been freed but transport_cb would still be called, so instead of assuming the setup pointer would be valid try to lookup the list of active setups and log a warning when it happens.
--- profiles/audio/a2dp.c | 8 ++++++++ 1 file changed, 8 insertions(+)
profiles/audio/a2dp.c +8 -0
@@ -2217,6 +2217,14 @@ static void transport_cb(GIOChannel *io, GError *err, gpointer user_data) {struct a2dp_setup *setup = user_data;uint16_t omtu, imtu; +GSList *l; + + l =g_slist_find (setups, setup); +if (!l) { +warn ("bt_io_accept: setup %p no longer valid" , setup); +g_io_channel_shutdown (io, TRUE,NULL ); +return ; + }if (err) {error ("%s" , err->message);
Signature · 1 line
2.25.3
A message that is not in the archive (sent off-list or not yet received): CALWDO_UDqCm_tgA5aGyeRz=GDQYFnS+UC-AJ3h2NjGfJCSSwLw@mail.gmail.com
Luiz Augusto von Dentz
maintainerHi,
Quoted 36 lines · Alain Michaud
Hi Luiz,
Quoted 7 lines · On Mon., Jun. 1, 2020, 5:39 p.m. Luiz Augusto von Dentz…
From: Luiz Augusto von Dentz <[email protected]>
There have been reports of crashes on
transport_cbwhere the setup would most likely already have been freed buttransport_cbwould still be called, so instead of assuming the setup pointer would be valid try to lookup the list of active setups and log a warning when it happens.Reviewed-by Alain Michaud <[email protected]>Quoted 22 lines
--- profiles/audio/a2dp.c | 8 ++++++++ 1 file changed, 8 insertions(+)profiles/audio/a2dp.c +8
-0@@ -2217,6 +2217,14 @@ static void transport_cb(GIOChannel *io, GError *err, gpointer user_data) {struct a2dp_setup *setup = user_data;uint16_t omtu, imtu; +GSList *l; + + l =g_slist_find (setups, setup); +if (!l) { +warn ("bt_io_accept: setup %p no longer valid" , setup); +g_io_channel_shutdown (io, TRUE,NULL ); +return ; + }
Quoted 4 lines
Quoted 4 lines
profiles/audio/a2dp.c +0
-1if (err) {error ("%s" , err->message); --2.25.3
Pushed.
Signature · 1 line
Luiz Augusto von Dentz
Thanks Luiz!
Quoted 49 lines · Luiz Augusto von Dentz
Hi,
Quoted 36 lines · Alain Michaud
Hi Luiz,
Quoted 7 lines · On Mon., Jun. 1, 2020, 5:39 p.m. Luiz Augusto von Dentz…
From: Luiz Augusto von Dentz <[email protected]>
There have been reports of crashes on
transport_cbwhere the setup would most likely already have been freed buttransport_cbwould still be called, so instead of assuming the setup pointer would be valid try to lookup the list of active setups and log a warning when it happens.Reviewed-by Alain Michaud <[email protected]>Quoted 22 lines
--- profiles/audio/a2dp.c | 8 ++++++++ 1 file changed, 8 insertions(+)profiles/audio/a2dp.c +8
-0@@ -2217,6 +2217,14 @@ static void transport_cb(GIOChannel *io, GError *err, gpointer user_data) {struct a2dp_setup *setup = user_data;uint16_t omtu, imtu; +GSList *l; + + l =g_slist_find (setups, setup); +if (!l) { +warn ("bt_io_accept: setup %p no longer valid" , setup); +g_io_channel_shutdown (io, TRUE,NULL ); +return ; + }Quoted 4 lines
Quoted 4 lines
profiles/audio/a2dp.c +0
-1if (err) {error ("%s" , err->message); --2.25.3
Pushed.
--
Luiz Augusto von Dentz