From: Abdun Nihaal <abdun.nihaal@gmail.com>
To: andy@kernel.org
Cc: Abdun Nihaal <abdun.nihaal@gmail.com>,
gregkh@linuxfoundation.org, lorenzo.stoakes@oracle.com,
tzimmermann@suse.de, riyandhiman14@gmail.com,
willy@infradead.org, notro@tronnes.org,
thomas.petazzoni@free-electrons.com,
dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCH] staging: fbtft: fix potential memory leak in fbtft_framebuffer_alloc()
Date: Thu, 26 Jun 2025 22:54:10 +0530 [thread overview]
Message-ID: <20250626172412.18355-1-abdun.nihaal@gmail.com> (raw)
In the error paths after fb_info structure is successfully allocated,
the memory allocated in fb_deferred_io_init() for info->pagerefs is not
freed. Fix that by adding the cleanup function on the error path.
Fixes: c296d5f9957c ("staging: fbtft: core support")
Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
---
This patch is compile tested only. Not tested on real hardware.
Bug was found using our prototype static analysis tool.
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 da9c64152a60..39bced400065 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -692,6 +692,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display,
return info;
release_framebuf:
+ fb_deferred_io_cleanup(info);
framebuffer_release(info);
alloc_fail:
--
2.43.0
next reply other threads:[~2025-06-26 17:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-26 17:24 Abdun Nihaal [this message]
2025-06-26 17:50 ` [PATCH] staging: fbtft: fix potential memory leak in fbtft_framebuffer_alloc() Andy Shevchenko
2025-06-26 20:11 ` Dan Carpenter
2025-06-26 21:59 ` Andy Shevchenko
2025-06-27 11:07 ` Andy Shevchenko
2025-06-27 16:26 ` Abdun Nihaal
2025-06-26 18:02 ` Dan Carpenter
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=20250626172412.18355-1-abdun.nihaal@gmail.com \
--to=abdun.nihaal@gmail.com \
--cc=andy@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=lorenzo.stoakes@oracle.com \
--cc=notro@tronnes.org \
--cc=riyandhiman14@gmail.com \
--cc=thomas.petazzoni@free-electrons.com \
--cc=tzimmermann@suse.de \
--cc=willy@infradead.org \
/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