gadget: u_bam_data: Add protection for possible race condition
bam2bam_data_connect_work() is not protecting port->port_usb data
structure which is also being modified by bam_data_disconnect()
context. Hence if bam2bam_data_connect_work() is being scheduled
and usb cable is being disconnected, bam_data_disconnect() would
change port->port_usb. To fix this race condition, add proper
checks with using previous last event state and using proper locking
in bam2bam_data_connect_work().
Also in case of composition switch, currently pending work are not
being flushed, hence flush bam_data_wq workqueue when particular
configuration is being changed having these functions (qc_ecm/qc_rndis
/mbim).
CRs-Fixed: 718229
Change-Id: I0f4d8d7ca7e6ace151e281d3d8550d799f209bf0
Signed-off-by:
Mayank Rana <mrana@codeaurora.org>
Loading
Please register or sign in to comment