-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apple Airpods disconnect causing the crash #533
Comments
Please use ``` to quote code, it is not readable now |
Is this really based on bluez-5.48? If so can you rebase/check master? |
Any chance this is same/similar to #532 ? |
bluez-5.48-039-bluetooth_a2dp_ref_negative_abort.patch I have attached the patch as file . NO it does not look alike #532 """0:1raise/usr/src/debug/glibc/2.31+gitAUTOINC+1094741224-r0/git/signal/../sysdeps/unix/sysv/linux/internal-signals.h:862abort/usr/src/debug/glibc/2.31+gitAUTOINC+1094741224-r0/git/stdlib/abort.c:793__libc_message/usr/src/debug/glibc/2.31+gitAUTOINC+1094741224-r0/git/libio/../sysdeps/posix/libc_fatal.c:1554malloc_printerr/usr/src/debug/glibc/2.31+gitAUTOINC+1094741224-r0/git/malloc/malloc.c:53475_int_free/usr/src/debug/glibc/2.31+gitAUTOINC+1094741224-r0/git/malloc/malloc.c:41776g_slist_foreach/usr/src/debug/glib-2.0/1_2.62.4-r0/build/../glib-2.62.4/glib/gslist.c:8647g_slist_free_full/usr/src/debug/glib-2.0/1_2.62.4-r0/build/../glib-2.62.4/glib/gslist.c:1778setup_unref/usr/src/debug/bluez5/5.48-r0/build/../bluez-5.48/profiles/audio/a2dp.c:1759media_endpoint_cancel/usr/src/debug/bluez5/5.48-r0/build/../bluez-5.48/profiles/audio/media.c:14210clear_endpoint/usr/src/debug/bluez5/5.48-r0/build/../bluez-5.48/profiles/audio/media.c:15011avdtp_sep_set_state/usr/src/debug/bluez5/5.48-r0/build/../bluez-5.48/profiles/audio/avdtp.c:101712g_slist_foreach/usr/src/debug/glib-2.0/1_2.62.4-r0/build/../glib-2.62.4/glib/gslist.c:86413connection_lost/usr/src/debug/bluez5/5.48-r0/build/../bluez-5.48/profiles/audio/avdtp.c:111714session_cb/usr/src/debug/bluez5/5.48-r0/build/../bluez-5.48/profiles/audio/avdtp.c:226315g_main_context_dispatch/usr/src/debug/glib-2.0/1_2.62.4-r0/build/../glib-2.62.4/glib/gmain.c:321616g_main_context_iterate/usr/src/debug/glib-2.0/1_2.62.4-r0/build/../glib-2.62.4/glib/gmain.c:395817g_main_loop_run/usr/src/debug/glib-2.0/1_2.62.4-r0/build/../glib-2.62.4/glib/gmain.c:415218main/usr/src/debug/bluez5/5.48-r0/build/../bluez-5.48/src/main.c:90119__libc_start_main/usr/src/debug/glibc/2.31+gitAUTOINC+1094741224-r0/git/csu/libc-start.c:30820:21__libc_csu_init/usr/src/debug/glibc/2.31+gitAUTOINC+1094741224-r0/git/csu/elf-init.c:8722:23:STACK CONTENTOS|Linux|0.0.0 Linux 4.9.113 #1 SMP PREEMPT Mon May 1 17:48:06 UTC 2023 armv7l |
I see, the patch is white space damaged though(change of SPACE/TAB only) Too bad #532 looks unrelated ... Any ideas welcome |
Basically the fix is the setup->ref should never be negative , As in this case while setup->ref is negative its failing the condition |
Look like you patche can be written:
and
I cannot tell if this is the right fix |
Thank you will try the above changes, it should work . One more thing |
I am thinking ref shoul not be allowed to be negative, just skipping ref-- if ref = 0 or some such |
Yes below should also work
|
Use preview to check formatting |
This looks like an unbalanced reference thing, there is one too many avdtp_unref it seems. |
Yes, but the above defensive patch will hopefully not hard crash bluez when that happens so Same with the patch in #532
|
Disconnect the Apple Airpods. Remove one of the headphone from left ear and put in the Air pods case and close it is causing the crash
Call stack
setup_unref
media_endpoint_cancel
clear_endpoint
avdtp_sep_set_state
connection_lost
session_cb
main
2023 May 03 14:18:10.042481 bluetoothd[27482]: ../bluez-5.48/profiles/audio/a2dp.c:setup_free() 0x8f2ed8
2023 May 03 14:18:10.043061 bluetoothd[27482]: ../bluez-5.48/profiles/audio/avdtp.c:avdtp_unref() 0x9375a8: ref=1
2023 May 03 14:18:10.043549 bluetoothd[27482]: ../bluez-5.48/profiles/audio/a2dp.c:setup_unref() 0x8f2ed8: ref=-1
2023 May 03 14:18:10.055367 bluetoothd[27482]: ../bluez-5.48/profiles/audio/a2dp.c:setup_free() 0x8f2ed8
2023 May 03 14:18:10.055822 bluetoothd[27482]: ../bluez-5.48/profiles/audio/avdtp.c:avdtp_unref() 0xb3ddf608: ref=9573823
The crash is due to ref is being reduce to negative number and then Setupfree is deleting the g_slist_free_full which is already free
Because the check is , Ref greater than 0.
if (setup->ref > 0)
return;
setup_free(setup);
I have added fix and resolved the issue . Can you please review the changes
diff -Naur bluez-5.48.orig/profiles/audio/a2dp.c bluez-5.48/profiles/audio/a2dp.c
--- bluez-5.48.orig/profiles/audio/a2dp.c 2023-06-08 15:24:07.658122948 +0000
+++ bluez-5.48/profiles/audio/a2dp.c 2023-06-08 15:35:50.387580121 +0000
@@ -178,14 +178,15 @@
static void setup_unref(struct a2dp_setup *setup)
{
}
static struct a2dp_setup_cb *setup_cb_new(struct a2dp_setup *setup)
diff -Naur bluez-5.48.orig/profiles/audio/avdtp.c bluez-5.48/profiles/audio/avdtp.c
--- bluez-5.48.orig/profiles/audio/avdtp.c 2023-06-08 15:24:07.662123022 +0000
+++ bluez-5.48/profiles/audio/avdtp.c 2023-06-08 15:42:34.351257198 +0000
@@ -1180,27 +1180,26 @@
}
struct avdtp *avdtp_ref(struct avdtp *session)
The text was updated successfully, but these errors were encountered: