usb: gadget: diag: fix read/write race with unbind
Prevent against potential race condition when unbind occurs
while a usb_diag_read or usb_diag_write is being issued from
another thread. Do this by keeping a local copy of the in
and out usb_ep pointers, and also by doing a last-chance
equality check between ctxt and the usb_diag_ch priv_usb member
to determine if the connection is still valid. This ensures
that the contents of the ctxt pointer don't get reallocated
when in the midst of an unbind/rebind.
CRs-Fixed: 652651
Change-Id: I75f1dafb4aa688dd068bd58e2c0a72a3c8193d10
Signed-off-by:
Jack Pham <jackp@codeaurora.org>
Loading
Please register or sign in to comment