OSDN Git Service

Correct the logic of UIPC thread id check
authorSrinu Jella <sjella@codeaurora.org>
Tue, 12 May 2015 14:48:43 +0000 (20:18 +0530)
committerAndre Eisenbach <eisenbach@google.com>
Tue, 23 Jun 2015 22:45:07 +0000 (15:45 -0700)
Use case:   Check the A2dp play , pause from headset

STR:
Connect to the headset from DUT
Try play , pause from Headset once the song is started playing from headset.

Failure: Bluetooth process crashed due to invalid fd descriptor while
clearing fds using FD_CLR

Root cause: Root cause for this issue is pthread join mechanism for
UIPC thread is not proper ( incorrect logic ), as a result UIPC thread
still running, and A2DP media task will try to start a new UIPC thread
before the previous UIPC read thread is closed, finally sometimes
this scenario leads to this issue. This issue doesn't come always,
if the media task is in process of initiating the fds before staring
the new UIPC thread, and previous UIPC thread is in exiting state.

Fix: Correct the logic of UIPC thread id check while joining the UIPC thread.
Thread id might hold pointer value where it's value is negative vaule with
singed bit is set,so corrected the logic to check against zero or  non zero.

Bug: 21896912
Change-Id: I1307d848958656e718e95a972f258526470b1974

udrv/ulinux/uipc.c

index c3f8527..f3c746e 100644 (file)
@@ -569,7 +569,10 @@ void uipc_stop_main_server_thread(void)
     UIPC_UNLOCK();
 
     /* wait until read thread is fully terminated */
-    if (uipc_main.tid > 0)
+    /* tid might hold pointer value where it's value
+       is negative vaule with singed bit is set, so
+       corrected the logic to check zero or non zero */
+    if (uipc_main.tid)
         pthread_join(uipc_main.tid, NULL);
 }