All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: Fix a reference leak bug in ip22_check_gio()
@ 2025-12-04 10:36 Haoxiang Li
  2025-12-05 11:54 ` Maciej W. Rozycki
  2025-12-15 17:17 ` Thomas Bogendoerfer
  0 siblings, 2 replies; 3+ messages in thread
From: Haoxiang Li @ 2025-12-04 10:36 UTC (permalink / raw)
  To: tsbogend, haoxiang_li2024, FlorianSchandinat
  Cc: linux-mips, linux-kernel, stable

If gio_device_register fails, gio_dev_put() is required to
drop the gio_dev device reference.

Fixes: e84de0c61905 ("MIPS: GIO bus support for SGI IP22/28")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
---
 arch/mips/sgi-ip22/ip22-gio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/mips/sgi-ip22/ip22-gio.c b/arch/mips/sgi-ip22/ip22-gio.c
index 5893ea4e382c..19b70928d6dc 100644
--- a/arch/mips/sgi-ip22/ip22-gio.c
+++ b/arch/mips/sgi-ip22/ip22-gio.c
@@ -372,7 +372,8 @@ static void ip22_check_gio(int slotno, unsigned long addr, int irq)
 		gio_dev->resource.flags = IORESOURCE_MEM;
 		gio_dev->irq = irq;
 		dev_set_name(&gio_dev->dev, "%d", slotno);
-		gio_device_register(gio_dev);
+		if (gio_device_register(gio_dev))
+			gio_dev_put(gio_dev);
 	} else
 		printk(KERN_INFO "GIO: slot %d : Empty\n", slotno);
 }
-- 
2.25.1


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

end of thread, other threads:[~2025-12-15 17:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-04 10:36 [PATCH] MIPS: Fix a reference leak bug in ip22_check_gio() Haoxiang Li
2025-12-05 11:54 ` Maciej W. Rozycki
2025-12-15 17:17 ` Thomas Bogendoerfer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.