stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mfd: altera-sysmgr: fix device leak on sysmgr regmap lookup
@ 2025-09-25 15:02 Johan Hovold
  2025-09-26 19:28 ` Markus Elfring
  2025-10-09 12:32 ` (subset) " Lee Jones
  0 siblings, 2 replies; 3+ messages in thread
From: Johan Hovold @ 2025-09-25 15:02 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Johan Hovold, stable

Make sure to drop the reference taken to the sysmgr platform device when
retrieving its driver data.

Note that holding a reference to a device does not prevent its driver
data from going away.

Fixes: f36e789a1f8d ("mfd: altera-sysmgr: Add SOCFPGA System Manager")
Cc: stable@vger.kernel.org	# 5.2
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/mfd/altera-sysmgr.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mfd/altera-sysmgr.c b/drivers/mfd/altera-sysmgr.c
index fb5f988e61f3..90c6902d537d 100644
--- a/drivers/mfd/altera-sysmgr.c
+++ b/drivers/mfd/altera-sysmgr.c
@@ -117,6 +117,8 @@ struct regmap *altr_sysmgr_regmap_lookup_by_phandle(struct device_node *np,
 
 	sysmgr = dev_get_drvdata(dev);
 
+	put_device(dev);
+
 	return sysmgr->regmap;
 }
 EXPORT_SYMBOL_GPL(altr_sysmgr_regmap_lookup_by_phandle);
-- 
2.49.1


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

* Re: [PATCH] mfd: altera-sysmgr: fix device leak on sysmgr regmap lookup
  2025-09-25 15:02 [PATCH] mfd: altera-sysmgr: fix device leak on sysmgr regmap lookup Johan Hovold
@ 2025-09-26 19:28 ` Markus Elfring
  2025-10-09 12:32 ` (subset) " Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2025-09-26 19:28 UTC (permalink / raw)
  To: Johan Hovold, Lee Jones; +Cc: stable, LKML

> Make sure to drop the reference taken to the sysmgr platform device when
> retrieving its driver data.
…

How do you think about to increase the application of scope-based resource management?
https://elixir.bootlin.com/linux/v6.17-rc7/source/include/linux/device.h#L1180

Regards,
Markus

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

* Re: (subset) [PATCH] mfd: altera-sysmgr: fix device leak on sysmgr regmap lookup
  2025-09-25 15:02 [PATCH] mfd: altera-sysmgr: fix device leak on sysmgr regmap lookup Johan Hovold
  2025-09-26 19:28 ` Markus Elfring
@ 2025-10-09 12:32 ` Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2025-10-09 12:32 UTC (permalink / raw)
  To: Lee Jones, Johan Hovold; +Cc: linux-kernel, stable

On Thu, 25 Sep 2025 17:02:19 +0200, Johan Hovold wrote:
> Make sure to drop the reference taken to the sysmgr platform device when
> retrieving its driver data.
> 
> Note that holding a reference to a device does not prevent its driver
> data from going away.
> 
> 
> [...]

Applied, thanks!

[1/1] mfd: altera-sysmgr: fix device leak on sysmgr regmap lookup
      commit: e6ce75fac4a299805939e33f9f104829ba9ffdcc

--
Lee Jones [李琼斯]


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

end of thread, other threads:[~2025-10-09 12:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-25 15:02 [PATCH] mfd: altera-sysmgr: fix device leak on sysmgr regmap lookup Johan Hovold
2025-09-26 19:28 ` Markus Elfring
2025-10-09 12:32 ` (subset) " Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).