Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f6ec3d2c authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: gadget: Stall ep0 with OS desc setup when OS desc is not enabled"

parents 449c082b d79e0bdd
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -1958,14 +1958,20 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
		/*
		 * OS descriptors handling
		 */
		if (cdev->use_os_string && cdev->os_desc_config &&
		    (ctrl->bRequestType & USB_TYPE_VENDOR) &&
		    ctrl->bRequest == cdev->b_vendor_code) {
		if ((ctrl->bRequestType & USB_TYPE_VENDOR)) {
			struct usb_configuration	*os_desc_cfg;
			u8				*buf;
			int				interface;
			int				count = 0;

			/* If os descriptor config is not enable, stall ep0 */
			if (!cdev->use_os_string || !cdev->os_desc_config)
				return -EINVAL;

			/* Stall ep0 if bRequest is not same as b_vendor_code */
			if (ctrl->bRequest != cdev->b_vendor_code)
				return -EINVAL;

			req = cdev->os_desc_req;
			req->context = cdev;
			req->complete = composite_setup_complete;