Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a862b993 authored by Girish Mahadevan's avatar Girish Mahadevan
Browse files

msm_serial_hs: Add defensive checks due to sudden port close



In certain scenarios, it is possible for a close to be called on the tty
port while the rx thread is still processing. In certain scenarios a
race between the 2 threads could lead to unexpected results such as making
BAM API calls after the pipes are disconnected or the thread accessing the
framework structures after they're freed.
Add defensive checks to:
- Check the state of the rx pipes and tty before running the rx work
  thread.
- When closing the port, flush the rx work thread and wait till there
  are no pending buffers before forcing a close. Currently the shutdown
  waits on the flush state of the rx pipe to be in SHUTDOWN , but this
  only happens after the rx thread runs, kicks the runtime pm which puts
  it in the SHUTDOWN state. But since the port close calls the runtime pm
  suspend callback, just wait on the thread to finish the buffer.

Change-Id: Ibf56e1aeb0c6811fec36f7618933d74c367ed305
Signed-off-by: default avatarGirish Mahadevan <girishm@codeaurora.org>
parent ec82f6fd
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment