For now only 5 small fixes. Most importantly, we have a fix for the TRB

type used on unaligned transfers on dwc3. Also a fix for a NULL pointer
 dereference in dwc3_pci_remove(). Note that a recent commit on ffs was
 reverted because it causes a regression elsewere.
 -----BEGIN PGP SIGNATURE-----
 
 iQJRBAABCAA7FiEElLzh7wn96CXwjh2IzL64meEamQYFAlvsA4kdHGZlbGlwZS5i
 YWxiaUBsaW51eC5pbnRlbC5jb20ACgkQzL64meEamQZACxAAqxBJG80nGsRvGEFC
 w9AYtdHCQE56ye+bcoWEGAGIi9WrUMHzDpP0c8ENuzSvGxfidjrRSN8jx1WtMCMl
 rAoKocmFyIDpQCebhSZJE10MyNrw7DsI+AUVC5qdsmhGIybwZAMK78a920kTihc3
 fJZSP5I1jhEasLcFGWbWqxn4sWN8ZQ5rd/YW/E/FLRQZmHNm3NiXn2xyXRVXRRq6
 qqft9hWD2y+Y0BxCcd2jdYoyzRvEO1B8jqvMl3HRlvfn9l4nQ3xyb4xTDUBws3XE
 47E4DRcT3RCdjzLFHAZxE9Kg1cNy76M36RatUfZYBDdiYeB+Fcsgr+twe1eqSGwi
 RdETNAH6aIFBZHawo6Mkt+d/hpzzeczdHkzc19jXmgPIEK55lBjlZixL5HusWSOf
 mdffqbW/DOgn9smA1//+qJ/6zYo1t03LwJf1lRvfqNnz/p5103K9X+QpfLA7srtA
 o5wqWEbMOCI+yp4JsNqFq33jdIMp66eOjeao/4tg67/PYKb1Rz5siXUoEHmdDbIG
 Z3it7/3gEa2PUQ+AEgrh46TkUF/T5lKa612A6TtoUzXPlGK0TqFW1SHW/k7DMGhI
 g3COopCNvFlhPPwoDxT9Sf6+Py1ds+I85WDeFS9BCSqlyZReu0Lik8mJjb7xRiad
 ijm7+DBgjYV7j/FFIVHD48IbJZg=
 =hWLY
 -----END PGP SIGNATURE-----

Merge tag 'fixes-for-v4.20-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus

Felipe writes:

For now only 5 small fixes. Most importantly, we have a fix for the TRB
type used on unaligned transfers on dwc3. Also a fix for a NULL pointer
dereference in dwc3_pci_remove(). Note that a recent commit on ffs was
reverted because it causes a regression elsewere.

* tag 'fixes-for-v4.20-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb:
  usb: dwc3: gadget: fix ISOC TRB type on unaligned transfers
  Revert "usb: gadget: ffs: Fix BUG when userland exits with submitted AIO transfers"
  usb: dwc2: pci: Fix an error code in probe
  usb: dwc3: Fix NULL pointer exception in dwc3_pci_remove()
  usb: dwc3: gadget: Properly check last unaligned/zero chain TRB
  usb: dwc3: core: Clean up ULPI device
This commit is contained in:
Greg Kroah-Hartman 2018-11-14 14:24:07 -08:00
commit 4b8440abc9
5 changed files with 17 additions and 23 deletions

View file

@ -120,6 +120,7 @@ static int dwc2_pci_probe(struct pci_dev *pci,
dwc2 = platform_device_alloc("dwc2", PLATFORM_DEVID_AUTO);
if (!dwc2) {
dev_err(dev, "couldn't allocate dwc2 device\n");
ret = -ENOMEM;
goto err;
}

View file

@ -1499,6 +1499,7 @@ static int dwc3_probe(struct platform_device *pdev)
err5:
dwc3_event_buffers_cleanup(dwc);
dwc3_ulpi_exit(dwc);
err4:
dwc3_free_scratch_buffers(dwc);

View file

@ -283,8 +283,10 @@ static int dwc3_pci_probe(struct pci_dev *pci, const struct pci_device_id *id)
static void dwc3_pci_remove(struct pci_dev *pci)
{
struct dwc3_pci *dwc = pci_get_drvdata(pci);
struct pci_dev *pdev = dwc->pci;
gpiod_remove_lookup_table(&platform_bytcr_gpios);
if (pdev->device == PCI_DEVICE_ID_INTEL_BYT)
gpiod_remove_lookup_table(&platform_bytcr_gpios);
#ifdef CONFIG_PM
cancel_work_sync(&dwc->wakeup_work);
#endif

View file

@ -1081,7 +1081,7 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep,
/* Now prepare one extra TRB to align transfer size */
trb = &dep->trb_pool[dep->trb_enqueue];
__dwc3_prepare_one_trb(dep, trb, dwc->bounce_addr,
maxp - rem, false, 0,
maxp - rem, false, 1,
req->request.stream_id,
req->request.short_not_ok,
req->request.no_interrupt);
@ -1125,7 +1125,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep,
/* Now prepare one extra TRB to align transfer size */
trb = &dep->trb_pool[dep->trb_enqueue];
__dwc3_prepare_one_trb(dep, trb, dwc->bounce_addr, maxp - rem,
false, 0, req->request.stream_id,
false, 1, req->request.stream_id,
req->request.short_not_ok,
req->request.no_interrupt);
} else if (req->request.zero && req->request.length &&
@ -1141,7 +1141,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep,
/* Now prepare one extra TRB to handle ZLP */
trb = &dep->trb_pool[dep->trb_enqueue];
__dwc3_prepare_one_trb(dep, trb, dwc->bounce_addr, 0,
false, 0, req->request.stream_id,
false, 1, req->request.stream_id,
req->request.short_not_ok,
req->request.no_interrupt);
} else {
@ -2259,7 +2259,7 @@ static int dwc3_gadget_ep_reclaim_completed_trb(struct dwc3_ep *dep,
* with one TRB pending in the ring. We need to manually clear HWO bit
* from that TRB.
*/
if ((req->zero || req->unaligned) && (trb->ctrl & DWC3_TRB_CTRL_HWO)) {
if ((req->zero || req->unaligned) && !(trb->ctrl & DWC3_TRB_CTRL_CHN)) {
trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
return 1;
}

View file

@ -215,7 +215,6 @@ struct ffs_io_data {
struct mm_struct *mm;
struct work_struct work;
struct work_struct cancellation_work;
struct usb_ep *ep;
struct usb_request *req;
@ -1073,31 +1072,22 @@ ffs_epfile_open(struct inode *inode, struct file *file)
return 0;
}
static void ffs_aio_cancel_worker(struct work_struct *work)
{
struct ffs_io_data *io_data = container_of(work, struct ffs_io_data,
cancellation_work);
ENTER();
usb_ep_dequeue(io_data->ep, io_data->req);
}
static int ffs_aio_cancel(struct kiocb *kiocb)
{
struct ffs_io_data *io_data = kiocb->private;
struct ffs_data *ffs = io_data->ffs;
struct ffs_epfile *epfile = kiocb->ki_filp->private_data;
int value;
ENTER();
if (likely(io_data && io_data->ep && io_data->req)) {
INIT_WORK(&io_data->cancellation_work, ffs_aio_cancel_worker);
queue_work(ffs->io_completion_wq, &io_data->cancellation_work);
value = -EINPROGRESS;
} else {
spin_lock_irq(&epfile->ffs->eps_lock);
if (likely(io_data && io_data->ep && io_data->req))
value = usb_ep_dequeue(io_data->ep, io_data->req);
else
value = -EINVAL;
}
spin_unlock_irq(&epfile->ffs->eps_lock);
return value;
}