All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm: fix leaked dma handles after removing drm_pci_free
@ 2021-05-18 21:28 Joseph Kogut
  2021-05-26 19:18 ` Thomas Zimmermann
  0 siblings, 1 reply; 2+ messages in thread
From: Joseph Kogut @ 2021-05-18 21:28 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Joseph Kogut, christophe.jaillet, dri-devel

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>
---
 drivers/gpu/drm/drm_bufs.c         | 1 +
 drivers/gpu/drm/r128/ati_pcigart.c | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index ea3ca81be9dd..7eb3baed9a70 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -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);
diff --git a/drivers/gpu/drm/r128/ati_pcigart.c b/drivers/gpu/drm/r128/ati_pcigart.c
index fbb0cfd79758..04408f372f74 100644
--- a/drivers/gpu/drm/r128/ati_pcigart.c
+++ b/drivers/gpu/drm/r128/ati_pcigart.c
@@ -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;
 }
 
-- 
2.31.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm: fix leaked dma handles after removing drm_pci_free
  2021-05-18 21:28 [PATCH] drm: fix leaked dma handles after removing drm_pci_free Joseph Kogut
@ 2021-05-26 19:18 ` Thomas Zimmermann
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Zimmermann @ 2021-05-26 19:18 UTC (permalink / raw)
  To: Joseph Kogut, Daniel Vetter; +Cc: christophe.jaillet, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 1620 bytes --]



Am 18.05.21 um 23:28 schrieb Joseph Kogut:
> 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>

Applied to drm-misc-next. Thanks

Best regards
Thomas

> ---
>   drivers/gpu/drm/drm_bufs.c         | 1 +
>   drivers/gpu/drm/r128/ati_pcigart.c | 2 ++
>   2 files changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
> index ea3ca81be9dd..7eb3baed9a70 100644
> --- a/drivers/gpu/drm/drm_bufs.c
> +++ b/drivers/gpu/drm/drm_bufs.c
> @@ -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);
> diff --git a/drivers/gpu/drm/r128/ati_pcigart.c b/drivers/gpu/drm/r128/ati_pcigart.c
> index fbb0cfd79758..04408f372f74 100644
> --- a/drivers/gpu/drm/r128/ati_pcigart.c
> +++ b/drivers/gpu/drm/r128/ati_pcigart.c
> @@ -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;
>   }
>   
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-26 19:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18 21:28 [PATCH] drm: fix leaked dma handles after removing drm_pci_free Joseph Kogut
2021-05-26 19:18 ` Thomas Zimmermann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.