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)
commit466257d9968ac79575831250b039dc07566c7b13
tree6f51a4636cb2732200bc62c46f1fe0f43e755e16
parentd964d5ff68dba21b53368656adec3fb5f50426bb
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 24461d9792c2 ("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: 24461d9792c2 ("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