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

Commit 1ccf343c authored by Azhar Shaikh's avatar Azhar Shaikh
Browse files

usb: gadget: f_gsi: Fix setting of ep_type for GSI endpoints



Currently endpoint type is set as EP_TYPE_GSI in
gsi_update_function_bind_params() called from gsi_bind(). In
multi-config compositions, the endpoint type is over-written
with EP_TYPE_GSI, even for functions which do not support gsi.
Due to this over-writing, in case of diag compositions on cable
disconnect, the pending read requests were not flushed and hence
reference count of diag_context gets messed up. On next cable
connect the pending read request completes, decreases the reference
count of diag_context to 0 which eventually frees diag_context.
And then on next diag read, it tries to acquire a lock on freed
diag_context, which causes a crash.
Hence move the setting of the endpoint type in gsi_configure_ep()
called from gsi_set_alt(), so that it is set only for gsi endpoints.
Also set the endpoint type back to EP_TYPE_NORMAL in gsi_free_trbs()
so that for next composition switch which can be a non-gsi supported
the endpoint type is reset.
Also protect the freeing of dma_trb_pool with NULL check for non-gsi
endpoints.

CRs-fixed: 950978
Change-Id: I0a1b486786f37bd727eb8c988dd2115b7ac43d70
Signed-off-by: default avatarAzhar Shaikh <azhars@codeaurora.org>
parent 4d150bc9
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