Merge "usb: gadget: composite: Add spinlock protection for usb string descriptor"

This commit is contained in:
qctecmdr 2021-01-05 00:35:24 -08:00 • committed by Gerrit - the friendly Code Review server
commit 7bd2a2072a

View file

@ -1757,8 +1757,10 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
value = min(w_length, (u16) value);
break;
case USB_DT_STRING:
spin_lock(&cdev->lock);
value = get_string(cdev, req->buf,
w_index, w_value & 0xff);
spin_unlock(&cdev->lock);
if (value >= 0)
value = min(w_length, (u16) value);
break;