From: Jianglei Nie <niejianglei2021@163.com>
To: gregkh@linuxfoundation.org, tzimmermann@suse.de,
andriy.shevchenko@linux.intel.com, javierm@redhat.com,
sam@ravnborg.org, steve@sk2.org, noralf@tronnes.org,
u.kleine-koenig@pengutronix.de
Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
Jianglei Nie <niejianglei2021@163.com>
Subject: [PATCH] staging: fbtft: core: fix potential memory leak in fbtft_probe_common()
Date: Wed, 28 Sep 2022 14:23:01 +0800 [thread overview]
Message-ID: <20220928062301.6399-1-niejianglei2021@163.com> (raw)
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@163.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
next reply other threads:[~2022-09-28 6:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-28 6:23 Jianglei Nie [this message]
2024-04-04 16:35 ` [PATCH] staging: fbtft: core: fix potential memory leak in fbtft_probe_common() Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220928062301.6399-1-niejianglei2021@163.com \
--to=niejianglei2021@163.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=javierm@redhat.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=noralf@tronnes.org \
--cc=sam@ravnborg.org \
--cc=steve@sk2.org \
--cc=tzimmermann@suse.de \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).