usb: gadget: composite: Fix NULL pointer dereference
authorKishon Vijay Abraham I <kishon@ti.com>
Thu, 11 Jun 2015 16:42:11 +0000 (22:12 +0530)
committerFelipe Balbi <balbi@ti.com>
Mon, 6 Jul 2015 17:34:08 +0000 (12:34 -0500)
commitb4c21f0bdd2c0cd5d5be1bb56f0a28dae5041eed
tree884d032fc4ab2bd382603b3970208544538298d1
parent4088acf1e845aba35f30fb91dee10649edbd0e84
usb: gadget: composite: Fix NULL pointer dereference

commit f563d230903210acc ("usb: gadget: composite: add req_match method
to usb_function") accesses cdev->config even before set config
is invoked causing a NULL pointer dereferencing error while running
Lecroy Mass Storage Compliance test.

Fix it here by accessing cdev->config only if it is non NULL.

Fixes: commit f563d230903210acc ("usb: gadget: composite: add req_match
method to usb_function").

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/composite.c