Re: [PATCH] drm: Fix possible memleak and UAF in drm_addmap_core()

2022-11-25 Thread Stanislaw Gruszka
On Thu, Nov 24, 2022 at 09:02:19AM +0800, Gaosheng Cui wrote: > The dma_free_coherent() should be called when memory fails to > be allocated for list, or drm_map_handle() fails, otherwise there > will be a memory leak, so add dma_free_coherent to fix it. > > In addition, if drm_map_handle() fails

[PATCH] drm: Fix possible memleak and UAF in drm_addmap_core()

2022-11-23 Thread Gaosheng Cui
The dma_free_coherent() should be called when memory fails to be allocated for list, or drm_map_handle() fails, otherwise there will be a memory leak, so add dma_free_coherent to fix it. In addition, if drm_map_handle() fails in drm_addmap_core(), list will be freed, but list->head will not be rem