[PATCH] drm/nouveau: fix several DMA buffer leaks

Timur Tabi ttabi at nvidia.com
Thu Feb 1 21:26:49 UTC 2024


On Thu, 2024-02-01 at 13:55 -0600, Timur Tabi wrote:
> +static void
> +nvkm_gsp_mem_dtor(struct nvkm_gsp *gsp, struct nvkm_gsp_mem *mem)
> +{
> +       if (mem->data) {
> +               dma_free_coherent(gsp->subdev.device->dev, mem->size, mem-
> >data, mem->addr);
> +               mem->data = NULL;
> +               mem->addr = 0;
> +       }
> +}

Dave, what do you think about doing this:

if (mem->data) {

	memset(mem->data, 0, mem->size);   <-------

	dma_free_coherent(gsp->subdev.device->dev, mem->size,
mem->data, mem->addr);
	mem->data = NULL;
	mem->addr = 0;
}

This would help situations where a buffer is access by GSP-RM after we think
it's safe to free it.


More information about the Nouveau mailing list