diff options
author | Christophe Kerello <christophe.kerello@st.com> | 2018-03-15 09:34:17 +0100 |
---|---|---|
committer | Marek Vasut <marex@denx.de> | 2018-04-26 15:15:07 +0200 |
commit | d57ed4d9f2cb6abc9438104f321b4fe3bc829d57 (patch) | |
tree | 1a67ee05739ce52a5b915fccaca556b17c68c264 | |
parent | 003659bda94a1444ebdfefea3f0928f8e90f9d8f (diff) | |
download | u-boot-d57ed4d9f2cb6abc9438104f321b4fe3bc829d57.zip u-boot-d57ed4d9f2cb6abc9438104f321b4fe3bc829d57.tar.gz u-boot-d57ed4d9f2cb6abc9438104f321b4fe3bc829d57.tar.bz2 |
usb: gadget: composite: fix NULL pointer when a non standard request is received
In case usb configuration is unknown (cdev->config == NULL), non standard
request should not be processed.
Remove also the cdev->config check below which will never happen.
This issue was seen using ums feature.
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
-rw-r--r-- | drivers/usb/gadget/composite.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index d0ee784..a87639d 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -838,6 +838,9 @@ unknown: ctrl->bRequestType, ctrl->bRequest, w_value, w_index, w_length); + if (!cdev->config) + goto done; + /* * functions always handle their interfaces and endpoints... * punt other recipients (other, WUSB, ...) to the current @@ -882,7 +885,7 @@ unknown: value = f->setup(f, ctrl); else { c = cdev->config; - if (c && c->setup) + if (c->setup) value = c->setup(c, ctrl); } |