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

Valerio Setti vsetti at baylibre.com
Fri Nov 27 15:18:21 PST 2026


On Mon, 23 Nov 2026 19:15:48 +0000, Lee Jones <lee at kernel.org> 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 at baylibre.com>

-- 
Valerio Setti <vsetti at baylibre.com>



More information about the linux-arm-kernel mailing list