mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 21:59:12 -04:00
usb: gadget: composite: Add spinlock protection for usb string descriptor
During composition switch, android driver stops data transfers first and removes configuration before disabling the pullup. With this sequence there is a possibility for a race where usb_remove_config is in progress during which pullup is active and sending the setup request for strings with zero configuration value. Hence fix the issue by adding spinlock protection for get_sring descriptor. Change-Id: I13c601f0e48d847b322a2761cd52268963cacf01 Signed-off-by: Chandana Kishori Chiluveru <cchiluve@codeaurora.org>
This commit is contained in:
parent
5bf38f9905
commit
ccc0b0a122
1 changed files with 2 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue