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

Commit 65a0d43c authored by Mayank Rana's avatar Mayank Rana
Browse files

USB: gadget: f_mass_storage: Fix race condition using proper locking



fsg_common_free_luns() API is called from fsg_unbind() context when
composition switch or adbd is being killed which releases configured
LUNs (i.e. common->luns). common->luns are also being updated from
handle_exception() context when fsg_disable() invokes exception with
FSG_STATE_CONFIG_CHANGE value. In some cases it is observed that
common->luns are being updated from fsg_common_free_luns() when it is
already being used from handle_exception context. Hence fix this issue
by acquiring common->lock before freeing LUNs.

Also set common->nluns to zero after releaseing all LUNs.

CRs-Fixed: 863034
Change-Id: Iad26fe288f382e4d0b0e257aae348f6d80b45035
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent fb120d64
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