USB: gadget: fix null pointer dereference on non-dual speed gadgets
PATCH 1/2 USB: gadget: fix null pointer dereference on non-dual speed gadgets
The composite driver doesn't verify whether gadgets are dual speed when using the high speed descriptors.
USB drivers don't set usb_function->hs_descriptors on non-dual speed gadgets, which result in dereferencing a NULL pointer in set_config().
Signed-off-by Maurus Cuelenaere <[email protected]>
--- drivers/usb/gadget/composite.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/usb/gadget/composite.c +2 -1
@@ -431,7 +431,8 @@ static int set_config(struct usb_composite_dev *cdev,* function's setup callback instead of the current * configuration's setup callback. */ -if (gadget->speed ==USB_SPEED_HIGH ) +if (gadget->speed ==USB_SPEED_HIGH + &&gadget_is_dualspeed (gadget)) descriptors = f->hs_descriptors;else descriptors = f->descriptors;
Signature · 1 line
1.7.1