usb: diag_bridge: Avoid NULL pointer references
usb: diag_bridge: Avoid NULL pointer references

Increment the refcount on diag_bridge_open() and decrement it when
closing, as well as within read() and write(). This will ensure that
the bridge structure object won't be accidentally freed before the
diag client is done using the bridge. Also, although the client should
have the responsibility of not calling read or write after the bridge
is closed, protect against improper access by checking the structure
pointers for NULL.

CRs-fixed: 370666
Change-Id: I2697fc6e6a7eddd5d95a9dea4b980b8aaea74d2c
Signed-off-by: Jack Pham <cbd79eb9617449d4bb49d0087b0eb70c6cf062b0@codeaurora.org>

TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas