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

Skip to content
Commit c3111b53 authored by Guru Das Srinagesh's avatar Guru Das Srinagesh
Browse files

soc: qcom: altmode-glink: Execute client callback in work



Execute the client's callback in a separate thread to avoid the
following deadlock situation:

- altmode_callback() calls the client's callback when a valid amclient
  is found and program execution waits for it to finish.
- The client's callback calls altmode_send_data() to send the PAN_ACK.
- altmode_send_data() eventually calls altmode_write(), which is waiting
  for the response_received to be "completed" in altmode_callback().
- For response_received to be "completed", altmode_callback() must
  finish executing in order to process the USBC_CMD_WRITE_REQ message
  received from the remote subsystem.
- altmode_callback() cannot finish executing until altmode_send_data()
  returns.
- altmode_send_data() times out and passes on the error to the client.

Also perform the following:
- Add a check to ensure that the payload received from the remote
  subsystem is at least 9 bytes long.
- Prevent out of bounds access for USBC_CMD_WRITE_REQ message (which is
  of a different format than struct usbc_notify_ind_msg) by moving the
  port_index reading to only the USBC_NOTIFY_IND message in
  altmode_callback().

CRs-Fixed: 2713590
Fixes: 6c0ffc67 ("soc: altmode: Detect when remote subsys fails to respond")
Change-Id: I0f2c6ce0f843c43c9e7e301be9ff3ad913310f62
Signed-off-by: default avatarGuru Das Srinagesh <gurus@codeaurora.org>
parent b318939c
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