linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mfd: macsmc: Initialize mutex
@ 2025-09-25 20:33 Janne Grunau
  2025-09-27  2:28 ` Neal Gompa
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Janne Grunau @ 2025-09-25 20:33 UTC (permalink / raw)
  To: Sven Peter, Neal Gompa, Lee Jones
  Cc: asahi, linux-arm-kernel, linux-kernel, Janne Grunau

Struct apple_smc's mutex was not initialized before use. Surprisingly
this only resulted 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")
Signed-off-by: Janne Grunau <j@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 870c8b2028a8fc0e905c8934c2636824cbe5d527..3a117cf19145e86b642f40dc165b542b8df69070 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: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
change-id: 20250925-macsmc-mutex_init-80d7cb2aacfa

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



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

* Re: [PATCH] mfd: macsmc: Initialize mutex
  2025-09-25 20:33 [PATCH] mfd: macsmc: Initialize mutex Janne Grunau
@ 2025-09-27  2:28 ` Neal Gompa
  2025-09-27 13:57 ` Markus Elfring
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Neal Gompa @ 2025-09-27  2:28 UTC (permalink / raw)
  To: Janne Grunau; +Cc: Sven Peter, Lee Jones, asahi, linux-arm-kernel, linux-kernel

On Thu, Sep 25, 2025 at 4:33 PM Janne Grunau <j@jannau.net> wrote:
>
> Struct apple_smc's mutex was not initialized before use. Surprisingly
> this only resulted 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")
> Signed-off-by: Janne Grunau <j@jannau.net>
> ---
>  drivers/mfd/macsmc.c | 1 +
>  1 file changed, 1 insertion(+)
>

LGTM.

Reviewed-by: Neal Gompa <neal@gompa.dev>


-- 
真実はいつも一つ!/ Always, there's only one truth!


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

* Re: [PATCH] mfd: macsmc: Initialize mutex
  2025-09-25 20:33 [PATCH] mfd: macsmc: Initialize mutex Janne Grunau
  2025-09-27  2:28 ` Neal Gompa
@ 2025-09-27 13:57 ` Markus Elfring
  2025-10-01  9:55   ` Lee Jones
  2025-10-08 14:20 ` [PATCH] " Sven Peter
  2025-10-21 15:09 ` Lee Jones
  3 siblings, 1 reply; 10+ messages in thread
From: Markus Elfring @ 2025-09-27 13:57 UTC (permalink / raw)
  To: Janne Grunau, asahi, linux-arm-kernel
  Cc: LKML, Lee Jones, Neal Gompa, Sven Peter

> Struct apple_smc's mutex was not initialized before use. Surprisingly
> this only resulted in occasional NULL pointer dereferences in
> apple_smc_read() calls from the probe() functions of sub devices.

See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.17-rc7#n94

Regards,
Markus


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

* Re: [PATCH] mfd: macsmc: Initialize mutex
  2025-09-27 13:57 ` Markus Elfring
@ 2025-10-01  9:55   ` Lee Jones
  2025-10-01 11:13     ` Markus Elfring
  0 siblings, 1 reply; 10+ messages in thread
From: Lee Jones @ 2025-10-01  9:55 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Janne Grunau, asahi, linux-arm-kernel, LKML, Neal Gompa,
	Sven Peter

On Sat, 27 Sep 2025, Markus Elfring wrote:

> > Struct apple_smc's mutex was not initialized before use. Surprisingly
> > this only resulted in occasional NULL pointer dereferences in
> > apple_smc_read() calls from the probe() functions of sub devices.
> 
> See also:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.17-rc7#n94

Provide some context in your own words.

Don't expect others to click random links.

-- 
Lee Jones [李琼斯]


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

* Re: [PATCH] mfd: macsmc: Initialize mutex
  2025-10-01  9:55   ` Lee Jones
@ 2025-10-01 11:13     ` Markus Elfring
  2025-10-01 12:48       ` Lee Jones
  0 siblings, 1 reply; 10+ messages in thread
From: Markus Elfring @ 2025-10-01 11:13 UTC (permalink / raw)
  To: Lee Jones, Janne Grunau, asahi, linux-arm-kernel
  Cc: LKML, Neal Gompa, Sven Peter

>>> Struct apple_smc's mutex was not initialized before use. Surprisingly
>>> this only resulted in occasional NULL pointer dereferences in
>>> apple_smc_read() calls from the probe() functions of sub devices.
>>
>> See also:
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.17-rc7#n94
> 
> Provide some context in your own words.

Would contributors like to care more also for the usage of imperative mood
in proposed commit messages?


> Don't expect others to click random links.

Should the mentioned information source be better known since a while?

Regards,
Markus


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

* Re: [PATCH] mfd: macsmc: Initialize mutex
  2025-10-01 11:13     ` Markus Elfring
@ 2025-10-01 12:48       ` Lee Jones
  2025-10-01 12:52         ` Markus Elfring
  0 siblings, 1 reply; 10+ messages in thread
From: Lee Jones @ 2025-10-01 12:48 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Janne Grunau, asahi, linux-arm-kernel, LKML, Neal Gompa,
	Sven Peter

On Wed, 01 Oct 2025, Markus Elfring wrote:

> >>> Struct apple_smc's mutex was not initialized before use. Surprisingly
> >>> this only resulted in occasional NULL pointer dereferences in
> >>> apple_smc_read() calls from the probe() functions of sub devices.
> >>
> >> See also:
> >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.17-rc7#n94
> > 
> > Provide some context in your own words.
> 
> Would contributors like to care more also for the usage of imperative mood
> in proposed commit messages?
> 
> 
> > Don't expect others to click random links.
> 
> Should the mentioned information source be better known since a while?

By all means, provide the link as well.

However, you must also provide your own context.

-- 
Lee Jones [李琼斯]


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

* Re: mfd: macsmc: Initialize mutex
  2025-10-01 12:48       ` Lee Jones
@ 2025-10-01 12:52         ` Markus Elfring
  2025-10-08 13:57           ` Lee Jones
  0 siblings, 1 reply; 10+ messages in thread
From: Markus Elfring @ 2025-10-01 12:52 UTC (permalink / raw)
  To: Lee Jones, Janne Grunau, asahi, linux-arm-kernel
  Cc: LKML, Neal Gompa, Sven Peter

>>>>> Struct apple_smc's mutex was not initialized before use. Surprisingly
>>>>> this only resulted in occasional NULL pointer dereferences in
>>>>> apple_smc_read() calls from the probe() functions of sub devices.
…> However, you must also provide your own context.

Do you try to support the creation of improved change descriptions?

Regards,
Markus


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

* Re: mfd: macsmc: Initialize mutex
  2025-10-01 12:52         ` Markus Elfring
@ 2025-10-08 13:57           ` Lee Jones
  0 siblings, 0 replies; 10+ messages in thread
From: Lee Jones @ 2025-10-08 13:57 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Janne Grunau, asahi, linux-arm-kernel, LKML, Neal Gompa,
	Sven Peter

On Wed, 01 Oct 2025, Markus Elfring wrote:

> >>>>> Struct apple_smc's mutex was not initialized before use. Surprisingly
> >>>>> this only resulted in occasional NULL pointer dereferences in
> >>>>> apple_smc_read() calls from the probe() functions of sub devices.
> …> However, you must also provide your own context.
> 
> Do you try to support the creation of improved change descriptions?

Not to -pedantic levels, no.

-- 
Lee Jones [李琼斯]


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

* Re: [PATCH] mfd: macsmc: Initialize mutex
  2025-09-25 20:33 [PATCH] mfd: macsmc: Initialize mutex Janne Grunau
  2025-09-27  2:28 ` Neal Gompa
  2025-09-27 13:57 ` Markus Elfring
@ 2025-10-08 14:20 ` Sven Peter
  2025-10-21 15:09 ` Lee Jones
  3 siblings, 0 replies; 10+ messages in thread
From: Sven Peter @ 2025-10-08 14:20 UTC (permalink / raw)
  To: Janne Grunau, Neal Gompa, Lee Jones; +Cc: asahi, linux-arm-kernel, linux-kernel

On 25.09.25 22:33, Janne Grunau wrote:
> Struct apple_smc's mutex was not initialized before use. Surprisingly
> this only resulted 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")
> Signed-off-by: Janne Grunau <j@jannau.net>
> ---

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


Thanks,


Sven



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

* Re: [PATCH] mfd: macsmc: Initialize mutex
  2025-09-25 20:33 [PATCH] mfd: macsmc: Initialize mutex Janne Grunau
                   ` (2 preceding siblings ...)
  2025-10-08 14:20 ` [PATCH] " Sven Peter
@ 2025-10-21 15:09 ` Lee Jones
  3 siblings, 0 replies; 10+ messages in thread
From: Lee Jones @ 2025-10-21 15:09 UTC (permalink / raw)
  To: Janne Grunau
  Cc: Sven Peter, Neal Gompa, asahi, linux-arm-kernel, linux-kernel

On Thu, 25 Sep 2025, Janne Grunau wrote:

> Struct apple_smc's mutex was not initialized before use. Surprisingly
> this only resulted 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")

You need to Cc: Stable as well.  Please submit a [RESEND] with that done.

> Signed-off-by: Janne Grunau <j@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 870c8b2028a8fc0e905c8934c2636824cbe5d527..3a117cf19145e86b642f40dc165b542b8df69070 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: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
> change-id: 20250925-macsmc-mutex_init-80d7cb2aacfa
> 
> Best regards,
> -- 
> Janne Grunau <j@jannau.net>
> 

-- 
Lee Jones [李琼斯]


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

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

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-25 20:33 [PATCH] mfd: macsmc: Initialize mutex Janne Grunau
2025-09-27  2:28 ` Neal Gompa
2025-09-27 13:57 ` Markus Elfring
2025-10-01  9:55   ` Lee Jones
2025-10-01 11:13     ` Markus Elfring
2025-10-01 12:48       ` Lee Jones
2025-10-01 12:52         ` Markus Elfring
2025-10-08 13:57           ` Lee Jones
2025-10-08 14:20 ` [PATCH] " Sven Peter
2025-10-21 15:09 ` 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).