]> git.baikalelectronics.ru Git - kernel.git/commit
dmaengine: sh: usb-dmac: set tx_result parameters
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Thu, 18 Jun 2020 12:07:33 +0000 (21:07 +0900)
committerVinod Koul <vkoul@kernel.org>
Wed, 24 Jun 2020 06:04:53 +0000 (11:34 +0530)
commitafd312b0e6c469d0bc19a5a76620b12c874bb311
tree6f51a4636cb2732200bc62c46f1fe0f43e755e16
parent2286e00fa13fc38de03af0d7b7f3167d48a93f49
dmaengine: sh: usb-dmac: set tx_result parameters

A client driver (renesas_usbhs) assumed that
dmaengine_tx_status() could return the residue even if
the transfer was completed. However, this was not correct
usage [1] and this caused to break getting the residue after
the commit 5dba8f3197f9 ("dmaengine: virt-dma: Fix access after
free in vchan_complete()") actually. So, this is possible to get
wrong received size if the usb controller gets a short packet.
For example, g_zero driver causes "bad OUT byte" errors.

To use the tx_result from the renesas_usbhs driver when
the transfer is completed, set the tx_result parameters.

Notes that the renesas_usbhs driver needs to update for it.

[1]
https://lore.kernel.org/dmaengine/20200616165550.GP2324254@vkoul-mobl/

Reported-by: Hien Dang <hien.dang.eb@renesas.com>
Fixes: 5dba8f3197f9 ("dmaengine: virt-dma: Fix access after free in vchan_complete()")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://lore.kernel.org/r/1592482053-19433-1-git-send-email-yoshihiro.shimoda.uh@renesas.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/sh/usb-dmac.c