Skip to contentSkip to conversation

media: venus: protect against spurious interrupts during probe

PATCH In review Jorge Ramirez-Ortiz 4 participants 5 messages Jun 6, 2025 – Jun 19, 2025

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

PATCH v3 1/1 media: venus: protect against spurious interrupts during probe

Make sure the interrupt handler is initialized before the interrupt is registered.

If the IRQ is registered before hfi_create(), it's possible that an interrupt fires before the handler setup is complete, leading to a NULL dereference.

This error condition has been observed during system boot on Rb3Gen2.

Fixes af2c3834c8ca ("[media] media: venus: adding core part and helper functions")

---
v3:
Added Fixes tag
v2:
Fix authorship
Fix spelling mistake

 drivers/media/platform/qcom/venus/core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/platform/qcom/venus/core.c +4 -4
index d305d74bb152..5bd99d0aafe4 100644
@@ -424,13 +424,13 @@ static int venus_probe(struct platform_device *pdev)
 	INIT_DELAYED_WORK(&core->work, venus_sys_error_handler);
 	init_waitqueue_head(&core->sys_err_done);
 
-	ret = devm_request_threaded_irq(dev, core->irq, hfi_isr, venus_isr_thread,
-					IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
-					"venus", core);
+	ret = hfi_create(core, &venus_core_ops);
 	if (ret)
 		goto err_core_put;
 
-	ret = hfi_create(core, &venus_core_ops);
+	ret = devm_request_threaded_irq(dev, core->irq, hfi_isr, venus_isr_thread,
+					IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+					"venus", core);
 	if (ret)
 		goto err_core_put;
 
Signature · 1 line
2.34.1
Reviewed-by on v3 1/1
#1 lore raw
Quoted 33 lines · Jorge Ramirez-Ortiz

Make sure the interrupt handler is initialized before the interrupt is registered.

If the IRQ is registered before hfi_create(), it's possible that an interrupt fires before the handler setup is complete, leading to a NULL dereference.

This error condition has been observed during system boot on Rb3Gen2.

Fixes af2c3834c8ca ("[media] media: venus: adding core part and helper functions")

---
v3:
Added Fixes tag
v2:
Fix authorship
Fix spelling mistake

  drivers/media/platform/qcom/venus/core.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/platform/qcom/venus/core.c +1 -3
index d305d74bb152..5bd99d0aafe4 100644
@@ -424,13 +424,13 @@ static int venus_probe(struct platform_device *pdev)
  	INIT_DELAYED_WORK(&core->work, venus_sys_error_handler);
  	init_waitqueue_head(&core->sys_err_done);
 
-	ret = devm_request_threaded_irq(dev, core->irq, hfi_isr, venus_isr_thread,
-					IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
-					"venus", core);
+	ret = hfi_create(core, &venus_core_ops);

drivers/media/platform/qcom/venus/core.c static int venus_probe(struct platform_device *pdev) · line 436

Quoted 10 lines
drivers/media/platform/qcom/venus/core.c +3 -1
  	if (ret)
  		goto err_core_put;
 
-	ret = hfi_create(core, &venus_core_ops);
+	ret = devm_request_threaded_irq(dev, core->irq, hfi_isr, venus_isr_thread,
+					IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+					"venus", core);
  	if (ret)
  		goto err_core_put;
 
#2 lore raw
In reply to Jorge Ramirez-Ortiz
Quoted 33 lines · Jorge Ramirez-Ortiz

Make sure the interrupt handler is initialized before the interrupt is registered.

If the IRQ is registered before hfi_create(), it's possible that an interrupt fires before the handler setup is complete, leading to a NULL dereference.

This error condition has been observed during system boot on Rb3Gen2.

Fixes af2c3834c8ca ("[media] media: venus: adding core part and helper functions")

---
v3:
Added Fixes tag
v2:
Fix authorship
Fix spelling mistake

  drivers/media/platform/qcom/venus/core.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/platform/qcom/venus/core.c +1 -3
index d305d74bb152..5bd99d0aafe4 100644
@@ -424,13 +424,13 @@ static int venus_probe(struct platform_device *pdev)
  	INIT_DELAYED_WORK(&core->work, venus_sys_error_handler);
  	init_waitqueue_head(&core->sys_err_done);
 
-	ret = devm_request_threaded_irq(dev, core->irq, hfi_isr, venus_isr_thread,
-					IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
-					"venus", core);
+	ret = hfi_create(core, &venus_core_ops);

drivers/media/platform/qcom/venus/core.c static int venus_probe(struct platform_device *pdev) · line 436

Quoted 10 lines
drivers/media/platform/qcom/venus/core.c +3 -1
  	if (ret)
  		goto err_core_put;
 
-	ret = hfi_create(core, &venus_core_ops);
+	ret = devm_request_threaded_irq(dev, core->irq, hfi_isr, venus_isr_thread,
+					IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+					"venus", core);
  	if (ret)
  		goto err_core_put;
 

@Dikshita @Vikash.

Good/happy with this patch ? Looks right to me.

---
bod

Reviewed-by on v3 1/1
#3 lore raw
In reply to Jorge Ramirez-Ortiz
Quoted 33 lines · Jorge Ramirez-Ortiz

Make sure the interrupt handler is initialized before the interrupt is registered.

If the IRQ is registered before hfi_create(), it's possible that an interrupt fires before the handler setup is complete, leading to a NULL dereference.

This error condition has been observed during system boot on Rb3Gen2.

Fixes af2c3834c8ca ("[media] media: venus: adding core part and helper functions")

---
v3:
Added Fixes tag
v2:
Fix authorship
Fix spelling mistake

 drivers/media/platform/qcom/venus/core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/platform/qcom/venus/core.c +1 -3
index d305d74bb152..5bd99d0aafe4 100644
@@ -424,13 +424,13 @@ static int venus_probe(struct platform_device *pdev)
 	INIT_DELAYED_WORK(&core->work, venus_sys_error_handler);
 	init_waitqueue_head(&core->sys_err_done);
 
-	ret = devm_request_threaded_irq(dev, core->irq, hfi_isr, venus_isr_thread,
-					IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
-					"venus", core);
+	ret = hfi_create(core, &venus_core_ops);

drivers/media/platform/qcom/venus/core.c static int venus_probe(struct platform_device *pdev) · line 436

Quoted 10 lines
drivers/media/platform/qcom/venus/core.c +3 -1
 	if (ret)
 		goto err_core_put;
 
-	ret = hfi_create(core, &venus_core_ops);
+	ret = devm_request_threaded_irq(dev, core->irq, hfi_isr, venus_isr_thread,
+					IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+					"venus", core);
 	if (ret)
 		goto err_core_put;
 
Reviewed-by Tested-by on v3 1/1
#4 lore raw
In reply to Jorge Ramirez-Ortiz
Quoted 33 lines · Jorge Ramirez-Ortiz

Make sure the interrupt handler is initialized before the interrupt is registered.

If the IRQ is registered before hfi_create(), it's possible that an interrupt fires before the handler setup is complete, leading to a NULL dereference.

This error condition has been observed during system boot on Rb3Gen2.

Fixes af2c3834c8ca ("[media] media: venus: adding core part and helper functions")

---
v3:
Added Fixes tag
v2:
Fix authorship
Fix spelling mistake

 drivers/media/platform/qcom/venus/core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/platform/qcom/venus/core.c +1 -3
index d305d74bb152..5bd99d0aafe4 100644
@@ -424,13 +424,13 @@ static int venus_probe(struct platform_device *pdev)
 	INIT_DELAYED_WORK(&core->work, venus_sys_error_handler);
 	init_waitqueue_head(&core->sys_err_done);
 
-	ret = devm_request_threaded_irq(dev, core->irq, hfi_isr, venus_isr_thread,
-					IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
-					"venus", core);
+	ret = hfi_create(core, &venus_core_ops);

drivers/media/platform/qcom/venus/core.c static int venus_probe(struct platform_device *pdev) · line 436

Quoted 10 lines
drivers/media/platform/qcom/venus/core.c +3 -1
 	if (ret)
 		goto err_core_put;
 
-	ret = hfi_create(core, &venus_core_ops);
+	ret = devm_request_threaded_irq(dev, core->irq, hfi_isr, venus_isr_thread,
+					IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+					"venus", core);
 	if (ret)
 		goto err_core_put;