mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Haotian Zhang <vulab@iscas.ac.cn>
To: "Thorsten Scherer" <t.scherer@eckelmann.de>,
	"Pengutronix Kernel Team" <kernel@pengutronix.de>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Gavin Schenk" <g.schenk@eckelmann.de>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] siox: fix memory leak of master buffer on device release
Date: Fri,  9 Oct 2026 12:56:26 +0800	[thread overview]
Message-ID: <20261009045626.3122539-1-vulab@iscas.ac.cn> (raw)

siox_device_add() grows smaster->buf with krealloc() when the first
device is added, but the buffer is never freed. siox_master_release()
only frees the siox_master structure itself, so every unregister of a
master that had at least one device leaks its transfer buffer.

Release smaster->buf in siox_master_release().

Fixes: bbecb07fa0af ("siox: new driver framework for eckelmann SIOX")
Assisted-by: DeepSeek-V4.1-Flash
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
---
 drivers/siox/siox-core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/siox/siox-core.c b/drivers/siox/siox-core.c
index 3e8f3b6a4555..147dd1a3e146 100644
--- a/drivers/siox/siox-core.c
+++ b/drivers/siox/siox-core.c
@@ -673,6 +673,7 @@ static void siox_master_release(struct device *dev)
 {
 	struct siox_master *smaster = to_siox_master(dev);
 
+	kfree(smaster->buf);
 	kfree(smaster);
 }
 
-- 
2.25.1


             reply	other threads:[~2026-10-09  4:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-09  4:56 Haotian Zhang [this message]
2026-10-09  6:07 ` Krzysztof Kozlowski

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=20261009045626.3122539-1-vulab@iscas.ac.cn \
    --to=vulab@iscas.ac.cn \
    --cc=g.schenk@eckelmann.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=t.scherer@eckelmann.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

all inboxes | Powered by JetHome®