|
@@ -745,6 +745,12 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
|
|
|
*/
|
|
|
struct usb_gadget *gadget = epfile->ffs->gadget;
|
|
|
|
|
|
+ spin_lock_irq(&epfile->ffs->eps_lock);
|
|
|
+ /* In the meantime, endpoint got disabled or changed. */
|
|
|
+ if (epfile->ep != ep) {
|
|
|
+ spin_unlock_irq(&epfile->ffs->eps_lock);
|
|
|
+ return -ESHUTDOWN;
|
|
|
+ }
|
|
|
/*
|
|
|
* Controller may require buffer size to be aligned to
|
|
|
* maxpacketsize of an out endpoint.
|
|
@@ -752,6 +758,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
|
|
|
data_len = io_data->read ?
|
|
|
usb_ep_align_maybe(gadget, ep->ep, io_data->len) :
|
|
|
io_data->len;
|
|
|
+ spin_unlock_irq(&epfile->ffs->eps_lock);
|
|
|
|
|
|
data = kmalloc(data_len, GFP_KERNEL);
|
|
|
if (unlikely(!data))
|