[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220928062301.6399-1-niejianglei2021@163.com>
Date: Wed, 28 Sep 2022 14:23:01 +0800
From: Jianglei Nie <niejianglei2021@....com>
To: gregkh@...uxfoundation.org, tzimmermann@...e.de,
andriy.shevchenko@...ux.intel.com, javierm@...hat.com,
sam@...nborg.org, steve@....org, noralf@...nnes.org,
u.kleine-koenig@...gutronix.de
Cc: dri-devel@...ts.freedesktop.org, linux-fbdev@...r.kernel.org,
linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org,
Jianglei Nie <niejianglei2021@....com>
Subject: [PATCH] staging: fbtft: core: fix potential memory leak in fbtft_probe_common()
fbtft_probe_common() allocates a memory chunk for "info" with
fbtft_framebuffer_alloc(). When "display->buswidth == 0" is true, the
function returns without releasing the "info", which will lead to a
memory leak.
Fix it by calling fbtft_framebuffer_release() when "display->buswidth
== 0" is true.
Signed-off-by: Jianglei Nie <niejianglei2021@....com>
---
drivers/staging/fbtft/fbtft-core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index afaba94d1d1c..ecf595aff786 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -1225,6 +1225,7 @@ int fbtft_probe_common(struct fbtft_display *display,
if (display->buswidth == 0) {
dev_err(dev, "buswidth is not set\n");
+ fbtft_framebuffer_release(info);
return -EINVAL;
}
--
2.25.1
Powered by blists - more mailing lists