[PATCH] drm: nouveau: fix nvbe leakage

Ben Skeggs bskeggs at redhat.com
Tue Oct 8 00:35:29 CEST 2013


----- Original Message -----
> From: "Geyslan G. Bem" <geyslan at gmail.com>
> To: airlied at linux.ie, bskeggs at redhat.com, dri-devel at lists.freedesktop.org
> Cc: linux-kernel at vger.kernel.org, kernel-br at googlegroups.com, "Geyslan G. Bem" <geyslan at gmail.com>
> Sent: Tuesday, 8 October, 2013 8:14:26 AM
> Subject: [PATCH] drm: nouveau: fix nvbe leakage
> 
> Free memory allocated to nvbe when returning NULL.
> 
> Signed-off-by: Geyslan G. Bem <geyslan at gmail.com>
NACK.  ttm_dma_tt_init() calls the destructor if it fails, which frees the memory.

Ben.

> ---
>  drivers/gpu/drm/nouveau/nouveau_sgdma.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c
> b/drivers/gpu/drm/nouveau/nouveau_sgdma.c
> index 0843ebc..af8b66d 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c
> @@ -105,6 +105,9 @@ nouveau_sgdma_create_ttm(struct ttm_bo_device *bdev,
>  		nvbe->ttm.ttm.func = &nv50_sgdma_backend;
>  
>  	if (ttm_dma_tt_init(&nvbe->ttm, bdev, size, page_flags, dummy_read_page))
> +	{
> +		kfree(nvbe);
>  		return NULL;
> +	}
>  	return &nvbe->ttm.ttm;
>  }
> --
> 1.8.4
> 
> 


More information about the dri-devel mailing list