]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
usb: gadget: function: printer: avoid wrong list handling in printer_write()
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Mon, 21 May 2018 11:18:07 +0000 (20:18 +0900)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 5 Sep 2018 08:30:45 +0000 (10:30 +0200)
commitdbfec8aa499a69f0928860e1083ffabb82c44db9
tree686c9150e4b45bcc9f7a73df8fb24e805470859a
parent0b64f748d9bbaf500d145db1943e982209edab1a
usb: gadget: function: printer: avoid wrong list handling in printer_write()

BugLink: http://bugs.launchpad.net/bugs/1790188
commit 4a014a7339f441b0851ce012f469c0fadac61c81 upstream.

When printer_write() calls usb_ep_queue(), a udc driver (e.g.
renesas_usbhs driver) may call usb_gadget_giveback_request() in
the udc .queue ops immediately. Then, printer_write() calls
list_add(&req->list, &dev->tx_reqs_active) wrongly. After that,
if we do unbind the printer driver, WARN_ON() happens in
printer_func_unbind() because the list entry is not removed.

So, this patch moves list_add(&req->list, &dev->tx_reqs_active)
calling before usb_ep_queue().

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/usb/gadget/function/f_printer.c