Skip to contentSkip to conversation

media: sunxi-cir: Disable the interrupt before stopping the hardware

PATCH New Myeonghun Pak 1 participant 1 message Nov 12

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

PATCH 1/1 media: sunxi-cir: Disable the interrupt before stopping the hardware

The devm-managed IRQ remains registered after sunxi_ir_hw_exit() stops the hardware and rc_free_device() frees the rc device. A running handler can therefore access the FIFO with clocks gated or pass a freed rc device to the raw event code.

Call disable_irq() after rc_unregister_device() and before sunxi_ir_hw_exit() to wait for the handler before stopping the hardware and freeing the rc device.

For backports to kernels where rc_unregister_device() frees the rc device, disable the IRQ before unregistering it.

Found by a static analysis tool under development. Not tested on hardware.

---

 drivers/media/rc/sunxi-cir.c | 1 +
 1 file changed, 1 insertion(+)
drivers/media/rc/sunxi-cir.c +1 -0
index e97bd9e03c1f..9d22ad7aa94b 100644
@@ -374,6 +374,7 @@ static void sunxi_ir_remove(struct platform_device *pdev)
 	struct sunxi_ir *ir = platform_get_drvdata(pdev);
 
 	rc_unregister_device(ir->rc);
+	disable_irq(ir->irq);
 	sunxi_ir_hw_exit(&pdev->dev);
 	rc_free_device(ir->rc);
 }

base-commit: 630059a5a632377b9b7b487baccde92b7ae1dd47

Signature · 1 line
2.43.0