linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: imx_sc_key - Fix memory corruption on unload
@ 2025-11-01 13:25 Dan Carpenter
  2025-11-03 15:12 ` Frank Li
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2025-11-01 13:25 UTC (permalink / raw)
  To: Anson Huang
  Cc: Jiri Kosina, Benjamin Tissoires, Dmitry Torokhov, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, linux-input,
	linux-kernel, imx, linux-arm-kernel, kernel-janitors

This is supposed to be "priv" but we accidentally pass "&priv" which is
an address in the stack and so it will lead to memory corruption when
the imx_sc_key_action() function is called.  Remove the &.

Fixes: 768062fd1284 ("Input: imx_sc_key - use devm_add_action_or_reset() to handle all cleanups")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/input/keyboard/imx_sc_key.c | 2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/input/keyboard/imx_sc_key.c b/drivers/input/keyboard/imx_sc_key.c
index d18839f1f4f6..b620cd310cdb 100644
--- a/drivers/input/keyboard/imx_sc_key.c
+++ b/drivers/input/keyboard/imx_sc_key.c
@@ -158,7 +158,7 @@ static int imx_sc_key_probe(struct platform_device *pdev)
 		return error;
 	}
 
-	error = devm_add_action_or_reset(&pdev->dev, imx_sc_key_action, &priv);
+	error = devm_add_action_or_reset(&pdev->dev, imx_sc_key_action, priv);
 	if (error)
 		return error;
 
-- 
2.51.0



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

* Re: [PATCH] Input: imx_sc_key - Fix memory corruption on unload
  2025-11-01 13:25 [PATCH] Input: imx_sc_key - Fix memory corruption on unload Dan Carpenter
@ 2025-11-03 15:12 ` Frank Li
  2025-11-04  2:51 ` Peng Fan
  2025-11-04 18:58 ` Dmitry Torokhov
  2 siblings, 0 replies; 4+ messages in thread
From: Frank Li @ 2025-11-03 15:12 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Anson Huang, Jiri Kosina, Benjamin Tissoires, Dmitry Torokhov,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	linux-input, linux-kernel, imx, linux-arm-kernel, kernel-janitors

On Sat, Nov 01, 2025 at 04:25:27PM +0300, Dan Carpenter wrote:
> This is supposed to be "priv" but we accidentally pass "&priv" which is
> an address in the stack and so it will lead to memory corruption when
> the imx_sc_key_action() function is called.  Remove the &.
>
> Fixes: 768062fd1284 ("Input: imx_sc_key - use devm_add_action_or_reset() to handle all cleanups")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Frank Li <Frank.Li@nxp.com>

> ---
>  drivers/input/keyboard/imx_sc_key.c | 2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/input/keyboard/imx_sc_key.c b/drivers/input/keyboard/imx_sc_key.c
> index d18839f1f4f6..b620cd310cdb 100644
> --- a/drivers/input/keyboard/imx_sc_key.c
> +++ b/drivers/input/keyboard/imx_sc_key.c
> @@ -158,7 +158,7 @@ static int imx_sc_key_probe(struct platform_device *pdev)
>  		return error;
>  	}
>
> -	error = devm_add_action_or_reset(&pdev->dev, imx_sc_key_action, &priv);
> +	error = devm_add_action_or_reset(&pdev->dev, imx_sc_key_action, priv);
>  	if (error)
>  		return error;
>
> --
> 2.51.0
>


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

* Re: [PATCH] Input: imx_sc_key - Fix memory corruption on unload
  2025-11-01 13:25 [PATCH] Input: imx_sc_key - Fix memory corruption on unload Dan Carpenter
  2025-11-03 15:12 ` Frank Li
@ 2025-11-04  2:51 ` Peng Fan
  2025-11-04 18:58 ` Dmitry Torokhov
  2 siblings, 0 replies; 4+ messages in thread
From: Peng Fan @ 2025-11-04  2:51 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Anson Huang, Jiri Kosina, Benjamin Tissoires, Dmitry Torokhov,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	linux-input, linux-kernel, imx, linux-arm-kernel, kernel-janitors

On Sat, Nov 01, 2025 at 04:25:27PM +0300, Dan Carpenter wrote:
>This is supposed to be "priv" but we accidentally pass "&priv" which is
>an address in the stack and so it will lead to memory corruption when
>the imx_sc_key_action() function is called.  Remove the &.
>
>Fixes: 768062fd1284 ("Input: imx_sc_key - use devm_add_action_or_reset() to handle all cleanups")
>Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Thanks for the fix.

Reviewed-by: Peng Fan <peng.fan@nxp.com>


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

* Re: [PATCH] Input: imx_sc_key - Fix memory corruption on unload
  2025-11-01 13:25 [PATCH] Input: imx_sc_key - Fix memory corruption on unload Dan Carpenter
  2025-11-03 15:12 ` Frank Li
  2025-11-04  2:51 ` Peng Fan
@ 2025-11-04 18:58 ` Dmitry Torokhov
  2 siblings, 0 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2025-11-04 18:58 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Anson Huang, Jiri Kosina, Benjamin Tissoires, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, linux-input,
	linux-kernel, imx, linux-arm-kernel, kernel-janitors

On Sat, Nov 01, 2025 at 04:25:27PM +0300, Dan Carpenter wrote:
> This is supposed to be "priv" but we accidentally pass "&priv" which is
> an address in the stack and so it will lead to memory corruption when
> the imx_sc_key_action() function is called.  Remove the &.
> 
> Fixes: 768062fd1284 ("Input: imx_sc_key - use devm_add_action_or_reset() to handle all cleanups")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Applied, thank you.

-- 
Dmitry


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

end of thread, other threads:[~2025-11-04 18:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-01 13:25 [PATCH] Input: imx_sc_key - Fix memory corruption on unload Dan Carpenter
2025-11-03 15:12 ` Frank Li
2025-11-04  2:51 ` Peng Fan
2025-11-04 18:58 ` Dmitry Torokhov

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).