Skip to contentSkip to conversation

platform/x86: intel: punit_ipc: fix memory corruption

PATCH Superseded Dan Carpenter 3 participants 4 messages Nov 21, 2025 – Nov 24, 2025

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86: intel: punit_ipc: fix memory corruption

This passes a stack address to the IRQ handler, "&punit_ipcdev" vs "punit_ipcdev" without the ampersand. This means that the:

	complete(&ipcdev->cmd_complete);

in intel_punit_ioc() will corrupt the wrong memory.

Fixes fdca4f16f57d ("platform:x86: add Intel P-Unit mailbox IPC driver")
---
 drivers/platform/x86/intel/punit_ipc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/intel/punit_ipc.c +1 -1
index bafac8aa2baf..14513010daad 100644
@@ -250,7 +250,7 @@ static int intel_punit_ipc_probe(struct platform_device *pdev)
 	} else {
 		ret = devm_request_irq(&pdev->dev, irq, intel_punit_ioc,
 				       IRQF_NO_SUSPEND, "intel_punit_ipc",
-				       &punit_ipcdev);
+				       punit_ipcdev);
 		if (ret) {
 			dev_err(&pdev->dev, "Failed to request irq: %d\n", irq);
 			return ret;
Signature · 1 line
2.51.0
maintainer
#1 lore raw
Quoted 1 line · Dan Carpenter

This passes a stack address to the IRQ handler, "&punit_ipcdev" vs

This first part I don't get, why you think &punit_ipcdev is a stack address? The punit_ipcdev variable is defined in the global scope:

static IPC_DEV *punit_ipcdev;

Quoted 5 lines

"punit_ipcdev" without the ampersand. This means that the:

	complete(&ipcdev->cmd_complete);

in intel_punit_ioc() will corrupt the wrong memory.

Can you please also rephrace "will corrupt the wrong memory" as it has a bit awkward sound in it. My suggestion:

...will write to a wrong memory address corrupting it.

(I'd have done this edit myself but I wanted to ask about the stack address claim so better you just send v2.)

The change diff itself looks correct.

Quoted 20 lines
Fixes fdca4f16f57d ("platform:x86: add Intel P-Unit mailbox IPC driver")
---
 drivers/platform/x86/intel/punit_ipc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/intel/punit_ipc.c +1 -1
index bafac8aa2baf..14513010daad 100644
@@ -250,7 +250,7 @@ static int intel_punit_ipc_probe(struct platform_device *pdev)
 	} else {
 		ret = devm_request_irq(&pdev->dev, irq, intel_punit_ioc,
 				       IRQF_NO_SUSPEND, "intel_punit_ipc",
-				       &punit_ipcdev);
+				       punit_ipcdev);
 		if (ret) {
 			dev_err(&pdev->dev, "Failed to request irq: %d\n", irq);
 			return ret;
Signature · 1 line
 i.
#2 lore raw
Quoted 8 lines · Ilpo Järvinen
Quoted 1 line · Dan Carpenter

This passes a stack address to the IRQ handler, "&punit_ipcdev" vs

This first part I don't get, why you think &punit_ipcdev is a stack address? The punit_ipcdev variable is defined in the global scope:

static IPC_DEV *punit_ipcdev;

Ah, right. Sorry. I thought it was a local variable.

Yeah. Let me resend this.

regards,
dan carpenter

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

This passes a stack address to the IRQ handler, "&punit_ipcdev" vs "punit_ipcdev" without the ampersand. This means that the:

	complete(&ipcdev->cmd_complete);

in intel_punit_ioc() will corrupt the wrong memory.

Good catch, now the question, how this driver was ever tested?..

Signature · 2 lines
With Best Regards,
Andy Shevchenko