diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-09-21 10:05:41 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-09-21 10:05:41 +0200 |
commit | 60e70ecd7ae0f09ed07699517071eacb01c26d13 (patch) | |
tree | 084efed8b08b5377f721d363d9add94dabbc84ba /drivers/usb/gadget/function/f_printer.c | |
parent | bd7a3fe770ebd8391d1c7d072ff88e9e76d063eb (diff) | |
parent | 7661ca09b2ff98f48693f431bb01fed62830e433 (diff) |
Merge tag 'fixes-for-v4.14-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus
Felipe writes:
usb: fixes for v4.14-rc2
First set of fixes for the gadget side. Not much this time around,
things have been rather calm.
In no order whatsoever, this pull request contains:
- A DMA starvation fix on dwc3 caused by some recent changes to how we
map/unmap requests
- A build error fix on the snps_udc_plat.c driver
- A fix for how to we call ->udc_set_speed()
- Spinlock recursion fix on the printer gadget
- Removal of pointless comparisons on dummy driver
Diffstat (limited to 'drivers/usb/gadget/function/f_printer.c')
-rw-r--r-- | drivers/usb/gadget/function/f_printer.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/usb/gadget/function/f_printer.c b/drivers/usb/gadget/function/f_printer.c index 8df244fc9d80..ea0da35a44e2 100644 --- a/drivers/usb/gadget/function/f_printer.c +++ b/drivers/usb/gadget/function/f_printer.c @@ -555,6 +555,7 @@ printer_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr) size_t size; /* Amount of data in a TX request. */ size_t bytes_copied = 0; struct usb_request *req; + int value; DBG(dev, "printer_write trying to send %d bytes\n", (int)len); @@ -634,7 +635,11 @@ printer_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr) return -EAGAIN; } - if (usb_ep_queue(dev->in_ep, req, GFP_ATOMIC)) { + /* here, we unlock, and only unlock, to avoid deadlock. */ + spin_unlock(&dev->lock); + value = usb_ep_queue(dev->in_ep, req, GFP_ATOMIC); + spin_lock(&dev->lock); + if (value) { list_add(&req->list, &dev->tx_reqs); spin_unlock_irqrestore(&dev->lock, flags); mutex_unlock(&dev->lock_printer_io); |