[PATCH] drm/nouveau: fix several DMA buffer leaks
Dave Airlie
airlied at gmail.com
Fri Feb 2 03:16:48 UTC 2024
On Fri, 2 Feb 2024 at 07:33, Timur Tabi <ttabi at nvidia.com> wrote:
>
> 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.
I'd prefer to fill it with a posion value than 0
Dave.
More information about the Nouveau
mailing list