Re: [PATCH 04/13] mmc: meson-gx: Fail request when descriptor chain DMA mapping fails

From: Valerio Setti

Date: Fri Nov 27 2026 - 18:18:46 EST


On Mon, 23 Nov 2026 19:15:48 +0000, Lee Jones <lee@xxxxxxxxxx> wrote:
> meson_mmc_pre_req() flags eligible transfers with
> SD_EMMC_DESC_CHAIN_MODE before mapping the scatterlist with
> dma_map_sg(). If dma_map_sg() fails and returns 0, meson_mmc_pre_req()
> logs an error but leaves SD_EMMC_DESC_CHAIN_MODE set with
> data->sg_count equal to 0. When meson_mmc_request() subsequently
> dispatches the transfer to meson_mmc_desc_chain_transfer(), the
> for_each_sg() loop executes zero iterations and
> desc[data->sg_count - 1].cmd_cfg writes to desc[-1], corrupting memory
> immediately preceding the coherent descriptor buffer before starting the
> DMA engine.
>
> [...]

Reviewed-by: Valerio Setti <vsetti@xxxxxxxxxxxx>

--
Valerio Setti <vsetti@xxxxxxxxxxxx>