mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] mfd: macsmc: Initialize mutex
@ 2025-12-31  9:42 Janne Grunau
  2026-01-04 12:05 ` Sven Peter
  2026-01-09 17:30 ` (subset) " Lee Jones
  0 siblings, 2 replies; 3+ messages in thread
From: Janne Grunau @ 2025-12-31  9:42 UTC (permalink / raw)
  To: Sven Peter, Neal Gompa, Lee Jones
  Cc: asahi, linux-arm-kernel, linux-kernel, stable, Janne Grunau

Initialize struct apple_smc's mutex in apple_smc_probe(). Using the
mutex uninitialized surprisingly resulted only in occasional NULL
pointer dereferences in apple_smc_read() calls from the probe()
functions of sub devices.

Fixes: e038d985c9823 ("mfd: Add Apple Silicon System Management Controller")
Cc: stable@vger.kernel.org
Signed-off-by: Janne Grunau <j@jannau.net>
---
Changes in v2:
- rewritten commit message
- added missing Cc: stable
- rebased onto v6.19-rc1
- Link to v1: https://lore.kernel.org/r/20250925-macsmc-mutex_init-v1-1-416e9e644735@jannau.net
---
 drivers/mfd/macsmc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/macsmc.c b/drivers/mfd/macsmc.c
index e3893e255ce5e4bb4832d80ad1fc002d413a291a..3015e8d36d6e5bfdcea342c7d05a7b34788d7845 100644
--- a/drivers/mfd/macsmc.c
+++ b/drivers/mfd/macsmc.c
@@ -413,6 +413,7 @@ static int apple_smc_probe(struct platform_device *pdev)
 	if (!smc)
 		return -ENOMEM;
 
+	mutex_init(&smc->mutex);
 	smc->dev = &pdev->dev;
 	smc->sram_base = devm_platform_get_and_ioremap_resource(pdev, 1, &smc->sram);
 	if (IS_ERR(smc->sram_base))

---
base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
change-id: 20250925-macsmc-mutex_init-80d7cb2aacfa

Best regards,
-- 
Janne Grunau <j@jannau.net>


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

* Re: [PATCH v2] mfd: macsmc: Initialize mutex
  2025-12-31  9:42 [PATCH v2] mfd: macsmc: Initialize mutex Janne Grunau
@ 2026-01-04 12:05 ` Sven Peter
  2026-01-09 17:30 ` (subset) " Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Sven Peter @ 2026-01-04 12:05 UTC (permalink / raw)
  To: Janne Grunau, Neal Gompa, Lee Jones
  Cc: asahi, linux-arm-kernel, linux-kernel, stable

On 31.12.25 10:42, Janne Grunau wrote:
> Initialize struct apple_smc's mutex in apple_smc_probe(). Using the
> mutex uninitialized surprisingly resulted only in occasional NULL
> pointer dereferences in apple_smc_read() calls from the probe()
> functions of sub devices.
> 
> Fixes: e038d985c9823 ("mfd: Add Apple Silicon System Management Controller")
> Cc: stable@vger.kernel.org
> Signed-off-by: Janne Grunau <j@jannau.net>
> ---
> Changes in v2:
> - rewritten commit message
> - added missing Cc: stable
> - rebased onto v6.19-rc1
> - Link to v1: https://lore.kernel.org/r/20250925-macsmc-mutex_init-v1-1-416e9e644735@jannau.net
> ---

Reviewed-by: Sven Peter <sven@kernel.org>


Thanks,

Sven


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

* Re: (subset) [PATCH v2] mfd: macsmc: Initialize mutex
  2025-12-31  9:42 [PATCH v2] mfd: macsmc: Initialize mutex Janne Grunau
  2026-01-04 12:05 ` Sven Peter
@ 2026-01-09 17:30 ` Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2026-01-09 17:30 UTC (permalink / raw)
  To: Sven Peter, Neal Gompa, Lee Jones, Janne Grunau
  Cc: asahi, linux-arm-kernel, linux-kernel, stable

On Wed, 31 Dec 2025 10:42:12 +0100, Janne Grunau wrote:
> Initialize struct apple_smc's mutex in apple_smc_probe(). Using the
> mutex uninitialized surprisingly resulted only in occasional NULL
> pointer dereferences in apple_smc_read() calls from the probe()
> functions of sub devices.
> 
> 

Applied, thanks!

[1/1] mfd: macsmc: Initialize mutex
      commit: 9f7cd8015f588755ada102d400c58ed1ca28a63d

--
Lee Jones [李琼斯]


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

end of thread, other threads:[~2026-01-09 17:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-31  9:42 [PATCH v2] mfd: macsmc: Initialize mutex Janne Grunau
2026-01-04 12:05 ` Sven Peter
2026-01-09 17:30 ` (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

all inboxes | Powered by JetHome®