usb: ks_bridge: Synchronize disconnect with ongoing IO
Following scenarios possible for interface disconnect racing with ongoing IO:- 1) Interface disconnect setting interface pointer to NULL and rx work is executing on other core dereferencing interface pointer, causing kernel panic. Cancel a work and wait for it to finish during disconnect. 2) Interface disconnect setting interface pointer to NULL and tx completion running on other core dereferencing interface pointer while calling usb_autopm_put_interface_async() API. Check for USB_DEV_CONNECTED flag(cleared at the time of disconnect) before dereferencing the interface pointer. 3) Interface unbound and driver is accessing already freed interface pointer in tx completion or usb device pointer to re-submit rx urb in rx completion. Add rx and tx urb pending counters and wait for them to become zero (or timeout) during disconnect. (cherry picked from commit b3779d1e3ed31d10c97094256c6d398af8484faa) Conflicts: drivers/usb/misc/ks_bridge.c CRs-Fixed: 448142 Change-Id: I50341173b94200bcfa60715b4b26b2117fc37c2c Signed-off-by:Hemant Kumar <hemantk@codeaurora.org> Signed-off-by:
Pavankumar Kondeti <pkondeti@codeaurora.org>
Loading
Please sign in to comment