drm: fix leaked dma handles after removing drm_pci_free
authorJoseph Kogut <joseph.kogut@gmail.com>
Tue, 18 May 2021 21:28:59 +0000 (14:28 -0700)
committerThomas Zimmermann <tzimmermann@suse.de>
Wed, 26 May 2021 19:18:13 +0000 (21:18 +0200)
After removing drm_pci_alloc/free, some instances where drm_pci_free()
would have kfreed the dma handle were skipped.

Ensure these handles are freed properly.

Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20210518212859.4148903-1-joseph.kogut@gmail.com
drivers/gpu/drm/drm_bufs.c
drivers/gpu/drm/r128/ati_pcigart.c

index c23d7f7..ae8e4d7 100644 (file)
@@ -685,6 +685,7 @@ static void drm_cleanup_buf_error(struct drm_device *dev,
                                                  dmah->size,
                                                  dmah->vaddr,
                                                  dmah->busaddr);
+                               kfree(dmah);
                        }
                }
                kfree(entry->seglist);
index 5d73043..0ecccf2 100644 (file)
@@ -71,6 +71,8 @@ static void drm_ati_free_pcigart_table(struct drm_device *dev,
        drm_dma_handle_t *dmah = gart_info->table_handle;
 
        dma_free_coherent(dev->dev, dmah->size, dmah->vaddr, dmah->busaddr);
+       kfree(dmah);
+
        gart_info->table_handle = NULL;
 }