public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] MIPS: ip22-gio: fix kfree() of static object
       [not found] <20260424102849.2616035-1-johan@kernel.org>
@ 2026-04-24 10:28 ` Johan Hovold
  2026-04-24 10:28 ` [PATCH 2/5] MIPS: ip22-gio: fix gio device memory leak Johan Hovold
  2026-04-24 10:28 ` [PATCH 3/5] MIPS: ip22-gio: fix device reference leak in probe Johan Hovold
  2 siblings, 0 replies; 3+ messages in thread
From: Johan Hovold @ 2026-04-24 10:28 UTC (permalink / raw)
  To: Thomas Bogendoerfer
  Cc: linux-mips, linux-kernel, Johan Hovold, stable, Levente Kurusa

The gio bus root device is a statically allocated object which must not
be freed by kfree() on failure to register the device or bus.

Fixes: 82242d28ff8b ("MIPS: IP22: Add missing put_device call")
Cc: stable@vger.kernel.org	# 3.17
Cc: Levente Kurusa <levex@linux.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 arch/mips/sgi-ip22/ip22-gio.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/mips/sgi-ip22/ip22-gio.c b/arch/mips/sgi-ip22/ip22-gio.c
index 9eec8842ffb7..a574441fa44b 100644
--- a/arch/mips/sgi-ip22/ip22-gio.c
+++ b/arch/mips/sgi-ip22/ip22-gio.c
@@ -30,7 +30,6 @@ static struct {
 
 static void gio_bus_release(struct device *dev)
 {
-	kfree(dev);
 }
 
 static struct device gio_bus = {
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/5] MIPS: ip22-gio: fix gio device memory leak
       [not found] <20260424102849.2616035-1-johan@kernel.org>
  2026-04-24 10:28 ` [PATCH 1/5] MIPS: ip22-gio: fix kfree() of static object Johan Hovold
@ 2026-04-24 10:28 ` Johan Hovold
  2026-04-24 10:28 ` [PATCH 3/5] MIPS: ip22-gio: fix device reference leak in probe Johan Hovold
  2 siblings, 0 replies; 3+ messages in thread
From: Johan Hovold @ 2026-04-24 10:28 UTC (permalink / raw)
  To: Thomas Bogendoerfer; +Cc: linux-mips, linux-kernel, Johan Hovold, stable

The gio device release callback was never wired up so gio devices are
not freed when the last reference is dropped.

Fixes: e84de0c61905 ("MIPS: GIO bus support for SGI IP22/28")
Cc: stable@vger.kernel.org	# 3.3
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 arch/mips/sgi-ip22/ip22-gio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/mips/sgi-ip22/ip22-gio.c b/arch/mips/sgi-ip22/ip22-gio.c
index a574441fa44b..2f5c6c6f8254 100644
--- a/arch/mips/sgi-ip22/ip22-gio.c
+++ b/arch/mips/sgi-ip22/ip22-gio.c
@@ -100,6 +100,8 @@ int gio_device_register(struct gio_device *giodev)
 {
 	giodev->dev.bus = &gio_bus_type;
 	giodev->dev.parent = &gio_bus;
+	giodev->dev.release = gio_release_dev;
+
 	return device_register(&giodev->dev);
 }
 EXPORT_SYMBOL_GPL(gio_device_register);
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 3/5] MIPS: ip22-gio: fix device reference leak in probe
       [not found] <20260424102849.2616035-1-johan@kernel.org>
  2026-04-24 10:28 ` [PATCH 1/5] MIPS: ip22-gio: fix kfree() of static object Johan Hovold
  2026-04-24 10:28 ` [PATCH 2/5] MIPS: ip22-gio: fix gio device memory leak Johan Hovold
@ 2026-04-24 10:28 ` Johan Hovold
  2 siblings, 0 replies; 3+ messages in thread
From: Johan Hovold @ 2026-04-24 10:28 UTC (permalink / raw)
  To: Thomas Bogendoerfer; +Cc: linux-mips, linux-kernel, Johan Hovold, stable

The gio probe function needlessly takes a device reference which is
never released and therefore prevents unbound gio devices from being
freed.

Fixes: e84de0c61905 ("MIPS: GIO bus support for SGI IP22/28")
Cc: stable@vger.kernel.org	# 3.3
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 arch/mips/sgi-ip22/ip22-gio.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/arch/mips/sgi-ip22/ip22-gio.c b/arch/mips/sgi-ip22/ip22-gio.c
index 2f5c6c6f8254..7b7572d11250 100644
--- a/arch/mips/sgi-ip22/ip22-gio.c
+++ b/arch/mips/sgi-ip22/ip22-gio.c
@@ -133,13 +133,9 @@ static int gio_device_probe(struct device *dev)
 	if (!drv->probe)
 		return error;
 
-	gio_dev_get(gio_dev);
-
 	match = gio_match_device(drv->id_table, gio_dev);
 	if (match)
 		error = drv->probe(gio_dev, match);
-	if (error)
-		gio_dev_put(gio_dev);
 
 	return error;
 }
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-04-24 10:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260424102849.2616035-1-johan@kernel.org>
2026-04-24 10:28 ` [PATCH 1/5] MIPS: ip22-gio: fix kfree() of static object Johan Hovold
2026-04-24 10:28 ` [PATCH 2/5] MIPS: ip22-gio: fix gio device memory leak Johan Hovold
2026-04-24 10:28 ` [PATCH 3/5] MIPS: ip22-gio: fix device reference leak in probe Johan Hovold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox