linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/tegra: Fix potential memory leak if vmap() fail
@ 2023-06-26 17:58 Sui Jingfeng
  0 siblings, 0 replies; only message in thread
From: Sui Jingfeng @ 2023-06-26 17:58 UTC (permalink / raw)
  To: Thierry Reding, Mikko Perttunen, David Airlie, Daniel Vetter,
	Jonathan Hunter
  Cc: dri-devel, linux-tegra, linux-kernel

The vmap function called in the tegra_fbdev_probe() function could fail,
It doesn't matther. But if the error handling is necessary, it should
also free the resources allocated by drm_fb_helper_alloc_info() function
and the gem buffer object allocated by tegra_bo_create().

Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
---
 drivers/gpu/drm/tegra/fbdev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/tegra/fbdev.c b/drivers/gpu/drm/tegra/fbdev.c
index e74d9be981c7..d2152b5eb77b 100644
--- a/drivers/gpu/drm/tegra/fbdev.c
+++ b/drivers/gpu/drm/tegra/fbdev.c
@@ -141,6 +141,8 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper,
 
 destroy:
 	drm_framebuffer_remove(fb);
+	drm_fb_helper_release_info(helper);
+	drm_gem_object_put(&bo->gem);
 	return err;
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-26 17:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-26 17:58 [PATCH] drm/tegra: Fix potential memory leak if vmap() fail Sui Jingfeng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).