Re: [PATCH v2 06/10] dmaengine: idxd: read GENCFG before clearing the event log enable
From: Frank Li
Date: Thu Dec 03 2026 - 12:49:43 EST
On Mon, Nov 30, 2026 at 11:47:17AM -0800, Daniel Byrne wrote:
> idxd_device_evl_free() clears the event log enable in a GENCFG value it
> never read. The other 31 bits it writes back are whatever the stack
> held, whereas the setup path and the GENCTRL update three lines below
> read the register first. Every unbind of the device driver, and both of
> its probe error paths, therefore program an arbitrary read buffer limit
> and arbitrary reserved bits. The limit is rewritten on the next enable
> only when one was configured, so with the default of none the arbitrary
> one stays in effect until the next device reset. The read was dropped
> with the evl_en test on the remove path when the log's memory leak was
> fixed.
>
> Read the register before changing the bit.
>
> Fixes: ee66bc295783 ("dmaengine: idxd: Fix leaking event log memory")
> Cc: stable@xxxxxxxxxxxxxxx # 7.0+
> Signed-off-by: Daniel Byrne <daniel1.byrne@xxxxxxxxx>
> ---
Reviewed-by: Frank Li <Frank.Li@xxxxxxx>
> New in v2.
>
> drivers/dma/idxd/device.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
> index 131138483b87..83665f7d8d6f 100644
> --- a/drivers/dma/idxd/device.c
> +++ b/drivers/dma/idxd/device.c
> @@ -835,6 +835,7 @@ static void idxd_device_evl_free(struct idxd_device *idxd)
> return;
>
> mutex_lock(&evl->lock);
> + gencfg.bits = ioread32(idxd->reg_base + IDXD_GENCFG_OFFSET);
> gencfg.evl_en = 0;
> iowrite32(gencfg.bits, idxd->reg_base + IDXD_GENCFG_OFFSET);
>
> --
> 2.43.0
>