usb: Fix race between diag_function_disable() and usb_diag_write()

There is a race when diag_function_disable() and usb_diag_write()
executes in parallel.
The diag context attribute is set to NULL in diag_function_disable()
which is later accessed in usb_diag_write() leading to NULL pointer
dereference.
Fix the issue by adding proper synchronization protection
for the diag context attribute in usb_diag_write().

CRs-Fixed: 620348
Change-Id: Ia2439c135bcab6ec9ed8191bd2e55cc1ac3abfdb
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
1 file changed