Re: [PATCH] MIPS: Fix a reference leak bug in ip22_check_gio()
From: Thomas Bogendoerfer
Date: Mon Dec 15 2025 - 12:18:34 EST
On Thu, Dec 04, 2025 at 06:36:18PM +0800, Haoxiang Li wrote:
> 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@xxxxxxxxxxxxxxx
> Signed-off-by: Haoxiang Li <haoxiang_li2024@xxxxxxx>
> ---
> 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
applied to mips-fixes
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]