[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250407082759.742105-1-thorsten.blum@linux.dev>
Date: Mon, 7 Apr 2025 10:27:58 +0200
From: Thorsten Blum <thorsten.blum@...ux.dev>
To: John Crispin <john@...ozen.org>,
Sergio Paracuellos <sergio.paracuellos@...il.com>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>
Cc: Thorsten Blum <thorsten.blum@...ux.dev>,
stable@...r.kernel.org,
linux-mips@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] MIPS: ralink: Fix refcount leak in ill_acc_of_setup()
The of_find_device_by_node() function increments the reference count of
the embedded device, which should be released with put_device() when it
is no longer needed.
In ill_acc_of_setup(), put_device() is only called on error paths, but
not on the success path. Fix this by calling put_device() before
returning successfully.
Compile-tested only.
Cc: stable@...r.kernel.org
Fixes: 5433acd81e873 ("MIPS: ralink: add illegal access driver")
Signed-off-by: Thorsten Blum <thorsten.blum@...ux.dev>
---
arch/mips/ralink/ill_acc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/mips/ralink/ill_acc.c b/arch/mips/ralink/ill_acc.c
index 25341b2319d0..6d1d829854b6 100644
--- a/arch/mips/ralink/ill_acc.c
+++ b/arch/mips/ralink/ill_acc.c
@@ -84,6 +84,7 @@ static int __init ill_acc_of_setup(void)
rt_memc_w32(ILL_INT_STATUS, REG_ILL_ACC_TYPE);
dev_info(&pdev->dev, "irq registered\n");
+ put_device(&pdev->dev);
return 0;
}
--
2.49.0
Powered by blists - more mailing lists