Re: [PATCH 01/10] i2c: imx-lpi2c: Clear rx_cmd_buf pointer after freeing in lpi2c_imx_dma_xfer()
From: Peng Fan (OSS)
Date: Fri Dec 04 2026 - 05:36:30 EST
On Thu, 3 Dec 2026 18:31:05 +0000 Lee Jones <lee@xxxxxxxxxx> wrote:
> lpi2c_imx->dma persists across transfers. On a DMA read, the
> disable_dma path frees dma->rx_cmd_buf without clearing the pointer.
> If a subsequent DMA read fails in lpi2c_dma_config() or
> lpi2c_dma_submit() before lpi2c_imx_alloc_rx_cmd_buf() runs, the
> cleanup path calls kfree(dma->rx_cmd_buf) a second time on the stale
> pointer.
>
> Reset dma->rx_cmd_buf to NULL immediately after freeing it.
>
> Fixes: a09c8b3f9047 ("i2c: imx-lpi2c: add eDMA mode support for LPI2C")
> Closes: https://sashiko.dev/#/bug/linux-17d925e1-8c99-4efb-a920-2c90ce2b53b5
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
Reviewed-by: Peng Fan <peng.fan@xxxxxxx>