Skip to contentSkip to conversation

Input: imx_sc_key - Fix memory corruption on unload

PATCH Applied Dan Carpenter 4 participants 4 messages Nov 1, 2025 – Nov 4, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Input: imx_sc_key - Fix memory corruption on unload

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")
---
 drivers/input/keyboard/imx_sc_key.c | 2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/input/keyboard/imx_sc_key.c +1 -1
index d18839f1f4f6..b620cd310cdb 100644
@@ -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;
 
Signature · 1 line
2.51.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Dan Carpenter

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")
Quoted 20 lines
---
 drivers/input/keyboard/imx_sc_key.c | 2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/input/keyboard/imx_sc_key.c +1 -2
index d18839f1f4f6..b620cd310cdb 100644
@@ -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

Reviewed-by on v1 1/1
#2 lore raw
In reply to Dan Carpenter
Quoted 6 lines · Dan Carpenter

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

Thanks for the fix.

maintainer Applied
#3 lore raw
In reply to Dan Carpenter
Quoted 6 lines · Dan Carpenter

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

Applied, thank you.

Signature · 1 line
Dmitry