mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 12:25:00 -04:00
Merge "usb: gadget: ffs: Use local copy of descriptors for userspace copy"
This commit is contained in:
commit
7531776c2b
1 changed files with 4 additions and 2 deletions
|
|
@ -1324,7 +1324,7 @@ static long ffs_epfile_ioctl(struct file *file, unsigned code,
|
|||
case FUNCTIONFS_ENDPOINT_DESC:
|
||||
{
|
||||
int desc_idx;
|
||||
struct usb_endpoint_descriptor *desc;
|
||||
struct usb_endpoint_descriptor desc1, *desc;
|
||||
|
||||
switch (epfile->ffs->gadget->speed) {
|
||||
case USB_SPEED_SUPER:
|
||||
|
|
@ -1336,10 +1336,12 @@ static long ffs_epfile_ioctl(struct file *file, unsigned code,
|
|||
default:
|
||||
desc_idx = 0;
|
||||
}
|
||||
|
||||
desc = epfile->ep->descs[desc_idx];
|
||||
memcpy(&desc1, desc, desc->bLength);
|
||||
|
||||
spin_unlock_irq(&epfile->ffs->eps_lock);
|
||||
ret = copy_to_user((void __user *)value, desc, desc->bLength);
|
||||
ret = copy_to_user((void __user *)value, &desc1, desc1.bLength);
|
||||
if (ret)
|
||||
ret = -EFAULT;
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Reference in a new issue