diff options
author | Gary King <gking@nvidia.com> | 2009-12-07 21:09:05 -0800 |
---|---|---|
committer | Gary King <gking@nvidia.com> | 2009-12-08 13:53:03 -0800 |
commit | 7f05db38f3f2b483fccba60812fbd0474be85b7a (patch) | |
tree | 3c883cf7f2f88ad9a68425f8bdc48d6b9436a44e /drivers/usb | |
parent | 8e7ce1eee1b7c82fe457104176d785c046a83b48 (diff) |
gadget: check for NULL before dereferencing cdev->config
don't attempt to dereference a function before it has been registered
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/composite.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 6995a10a608a..185385b185df 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -779,7 +779,9 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) goto unknown; if (!cdev->config || w_index >= MAX_CONFIG_INTERFACES) break; - f = cdev->config->interface[intf]; + f = NULL; + if (cdev->config) + f = cdev->config->interface[intf]; if (!f) break; if (w_value && !f->set_alt) |