From: Guangshuo Li <lgs201920130244@gmail.com>
To: "Vladimir Kondratiev" <vladimir.kondratiev@mobileye.com>,
"Gregory CLEMENT" <gregory.clement@bootlin.com>,
"Théo Lebrun" <theo.lebrun@bootlin.com>,
"Michael Turquette" <mturquette@baylibre.com>,
"Stephen Boyd" <sboyd@kernel.org>,
linux-mips@vger.kernel.org, linux-clk@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Guangshuo Li <lgs201920130244@gmail.com>, stable@vger.kernel.org
Subject: [PATCH v2] clk: eyeq: fix memory leak in eqc_auxdev_create() error path
Date: Sun, 12 Apr 2026 20:42:46 +0800 [thread overview]
Message-ID: <20260412124247.2494971-1-lgs201920130244@gmail.com> (raw)
eqc_auxdev_create() allocates an auxiliary_device with kzalloc() before
calling auxiliary_device_init().
When auxiliary_device_init() returns an error, the function exits
without freeing adev. Since the release callback is only expected to
handle cleanup after successful initialization, adev should be freed
explicitly in this path.
Add the missing kfree(adev) before returning from the
auxiliary_device_init() error path.
Fixes: 25d904946a0b ("clk: eyeq: add driver")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
drivers/clk/clk-eyeq.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/clk-eyeq.c b/drivers/clk/clk-eyeq.c
index ea1c3d78e7cd..a48ecec4c9a5 100644
--- a/drivers/clk/clk-eyeq.c
+++ b/drivers/clk/clk-eyeq.c
@@ -346,8 +346,10 @@ static int eqc_auxdev_create(struct device *dev, void __iomem *base,
adev->id = id;
ret = auxiliary_device_init(adev);
- if (ret)
+ if (ret) {
+ kfree(adev);
return ret;
+ }
ret = auxiliary_device_add(adev);
if (ret)
--
2.43.0
next reply other threads:[~2026-04-12 12:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-12 12:42 Guangshuo Li [this message]
2026-04-13 8:04 ` [PATCH v2] clk: eyeq: fix memory leak in eqc_auxdev_create() error path Théo Lebrun
2026-04-14 11:51 ` Guangshuo Li
2026-04-13 16:42 ` Brian Masney
2026-04-14 11:49 ` Guangshuo Li
2026-04-14 20:06 ` Brian Masney
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=20260412124247.2494971-1-lgs201920130244@gmail.com \
--to=lgs201920130244@gmail.com \
--cc=gregory.clement@bootlin.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@kernel.org \
--cc=stable@vger.kernel.org \
--cc=theo.lebrun@bootlin.com \
--cc=vladimir.kondratiev@mobileye.com \
/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