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

Commit eb60dbd1 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "USB: f_fs: Fix disconnect check during ongoing IO"

parents 408666b7 49543322
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -879,13 +879,21 @@ first_try:
			ret = -EIO;
		} else if (unlikely(wait_for_completion_interruptible(&done))) {
			spin_lock_irq(&epfile->ffs->eps_lock);
			if (ep->ep)
			/*
			 * While we were acquiring lock endpoint got disabled
			 * (disconnect) or changed (composition switch) ?
			 */
			if (epfile->ep == ep)
				usb_ep_dequeue(ep->ep, req);
			spin_unlock_irq(&epfile->ffs->eps_lock);
			ret = -EINTR;
		} else {
			spin_lock_irq(&epfile->ffs->eps_lock);
			if (ep->ep)
			/*
			 * While we were acquiring lock endpoint got disabled
			 * (disconnect) or changed (composition switch) ?
			 */
			if (epfile->ep == ep)
				ret = ep->status;
			else
				ret = -ENODEV;
@@ -1565,6 +1573,7 @@ static void ffs_func_free(struct ffs_function *func)
		if (ep->ep && ep->req)
			usb_ep_free_request(ep->ep, ep->req);
		ep->req = NULL;
		ep->ep = NULL;
		++ep;
	} while (--count);
	spin_unlock_irqrestore(&func->ffs->eps_lock, flags);