USB: gadget: f_fs: Fix adb issues due to retrying adb_read
Commit b0d8bfa8 ("USB: gadget: ffs: Fix USBCV compliance failure due to adbd") retries read if disconnect/reset happened without any data transfers between set_alt and disable. This allows userspace to not unnecessarily perform unbind-bind. As part of that driver leaves data as not NULL (from previous read) and clears only read->error flag. This leads to two issues. If disconnect-connect happened with adb server not running on host then write->error flag is not cleared, hence subsequent adb_write fails. This results in adb going offline. Memory corruption due to double free of memory as data ptr is not NULL (post retry) when adbd receives signal. Fix these by clearing all epfile->error flags and set data pointer to NULL on adb_read retry CRs-Fixed: 1114810 Change-Id: Ic3a5336b8d974d24355539c247434d98ab79b03f Signed-off-by:Arumuga Durai A <cadurai@codeaurora.org>
Loading
Please register or sign in to comment