Code: static void uipc_read_task(void *arg)
{
 int ch_id;
 int result;
    UNUSED(arg);

    prctl(PR_SET_NAME, (unsigned long)"uipc-main", 0, 0, 0);

    raise_priority_a2dp(TASK_UIPC_READ);

 while (uipc_main.running)

     {
         uipc_main.read_set = uipc_main.active_set;
 
        result = select(uipc_main.max_fd+1, &uipc_main.read_set, NULL, NULL, NULL);
 
         if (result == 0)
         {
            BTIF_TRACE_EVENT("select timeout");
 continue;
 }
 else if (result < 0)
 {
            BTIF_TRACE_EVENT("select failed %s", strerror(errno));
 continue;
 }

        UIPC_LOCK();

 /* clear any wakeup interrupt */
        uipc_check_interrupt_locked();

 /* check pending task events */
        uipc_check_task_flags_locked();

 /* make sure we service audio channel first */
        uipc_check_fd_locked(UIPC_CH_ID_AV_AUDIO);

 /* check for other connections */
 for (ch_id = 0; ch_id < UIPC_CH_NUM; ch_id++)
 {
 if (ch_id != UIPC_CH_ID_AV_AUDIO)
                uipc_check_fd_locked(ch_id);
 }

        UIPC_UNLOCK();
 }

    BTIF_TRACE_EVENT("UIPC READ THREAD EXITING");

    uipc_main_cleanup();

    uipc_main.tid = 0;

    BTIF_TRACE_EVENT("UIPC READ THREAD DONE");
}

Vulnerability Type: DoS 
CWE ID: CWE-284
Summary: Bluetooth in Android 4.x before 4.4.4, 5.0.x before 5.0.2, 5.1.x before 5.1.1, and 6.x before 2016-08-01 allows attackers to cause a denial of service (loss of Bluetooth 911 functionality) via a crafted application that sends a signal to a Bluetooth process, aka internal bug 28885210.
Commit Message: DO NOT MERGE Fix potential DoS caused by delivering signal to BT process

Bug: 28885210
Change-Id: I63866d894bfca47464d6e42e3fb0357c4f94d360

 Conflicts:
	btif/co/bta_hh_co.c
	btif/src/btif_core.c
Merge conflict resolution of ag/1161415 (referencing ag/1164670)
- Directly into mnc-mr2-release
