usb: diag: Check for USB connect state in usb_diag_read/write

With new composition framework unbind function of the driver
is called during composition switch. This results in NULL
pointer dereference in usb_diag_read/write while trying to
access priv_usb field of usb_diag_ch.
WIth the previous compositon framework unbind function was not
called, hence, this issue was also not observed.

Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
diff --git a/drivers/usb/gadget/f_diag.c b/drivers/usb/gadget/f_diag.c
index 5366018..f950286 100644
--- a/drivers/usb/gadget/f_diag.c
+++ b/drivers/usb/gadget/f_diag.c
@@ -388,6 +388,9 @@
 	unsigned long flags;
 	struct usb_request *req;
 
+	if (!ctxt)
+		return -ENODEV;
+
 	spin_lock_irqsave(&ctxt->lock, flags);
 
 	if (!ctxt->configured) {
@@ -441,6 +444,9 @@
 	unsigned long flags;
 	struct usb_request *req = NULL;
 
+	if (!ctxt)
+		return -ENODEV;
+
 	spin_lock_irqsave(&ctxt->lock, flags);
 
 	if (!ctxt->configured) {