The userial read loop uses one global flag
to condition the serial port read and a
second global file descriptor variable that
may change from another thread underneath it.
Check the validity of the serial port file
descriptor by making a copy immediately before
the read and only proceeding if it's a valid fd.
bug:
17552690
Change-Id: Iaaf1b8476fdee462ddc178d2a31ef8f55cb33e52
p_buf->layer_specific = 0;
p = (uint8_t *) (p_buf + 1);
- rx_length = select_read(userial_cb.fd, p, HCI_MAX_FRAME_SIZE + 1);
+ int userial_fd = userial_cb.fd;
+ if (userial_fd != -1)
+ rx_length = select_read(userial_fd, p, HCI_MAX_FRAME_SIZE + 1);
+ else
+ rx_length = 0;
}
else
{