Re: [PATCH] serial: sh-sci: Check that the DMA cookie is valid

From: Geert Uytterhoeven

Date: Wed Jan 07 2026 - 03:44:53 EST


On Thu, 18 Dec 2025 at 08:40, Claudiu <claudiu.beznea@xxxxxxxxx> wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@xxxxxxxxxxxxxx>
>
> The driver updates struct sci_port::tx_cookie to zero right before the TX
> work is scheduled, or to -EINVAL when DMA is disabled.
> dma_async_is_complete(), called through dma_cookie_status() (and possibly
> through dmaengine_tx_status()), considers cookies valid only if they have
> values greater than or equal to 1.
>
> Passing zero or -EINVAL to dmaengine_tx_status() before any TX DMA
> transfer has started leads to an incorrect TX status being reported, as the
> cookie is invalid for the DMA subsystem. This may cause long wait times
> when the serial device is opened for configuration before any TX activity
> has occurred.
>
> Check that the TX cookie is valid before passing it to
> dmaengine_tx_status().
>
> Fixes: 7cc0e0a43a91 ("serial: sh-sci: Check if TX data was written to device in .tx_empty()")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@xxxxxxxxxxxxxx>

Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds