usb: gadget: composite: Fix NULL pointer dereference
commitf563d23090
("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: commitf563d23090
("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>
This commit is contained in:
parent
4088acf1e8
commit
b4c21f0bdd
1 changed files with 7 additions and 4 deletions
|
@ -1758,10 +1758,13 @@ unknown:
|
||||||
* take such requests too, if that's ever needed: to work
|
* take such requests too, if that's ever needed: to work
|
||||||
* in config 0, etc.
|
* in config 0, etc.
|
||||||
*/
|
*/
|
||||||
|
if (cdev->config) {
|
||||||
list_for_each_entry(f, &cdev->config->functions, list)
|
list_for_each_entry(f, &cdev->config->functions, list)
|
||||||
if (f->req_match && f->req_match(f, ctrl))
|
if (f->req_match && f->req_match(f, ctrl))
|
||||||
goto try_fun_setup;
|
goto try_fun_setup;
|
||||||
f = NULL;
|
f = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
switch (ctrl->bRequestType & USB_RECIP_MASK) {
|
switch (ctrl->bRequestType & USB_RECIP_MASK) {
|
||||||
case USB_RECIP_INTERFACE:
|
case USB_RECIP_INTERFACE:
|
||||||
if (!cdev->config || intf >= MAX_CONFIG_INTERFACES)
|
if (!cdev->config || intf >= MAX_CONFIG_INTERFACES)
|
||||||
|
|
Loading…
Add table
Reference in a new issue