]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
media: venus: protect against spurious interrupts during probe
authorJorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
Fri, 6 Jun 2025 15:25:22 +0000 (17:25 +0200)
committerHans Verkuil <hverkuil@xs4all.nl>
Thu, 3 Jul 2025 09:02:43 +0000 (11:02 +0200)
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")
Cc: stable@vger.kernel.org
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Reviewed-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Tested-by: Dikshita Agarwal <quic_dikshita@quicinc.com> # RB5
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
drivers/media/platform/qcom/venus/core.c

index d305d74bb152d21133c4dfa23805b17274426a5c..5bd99d0aafe4d7e8c1a9b7cc6e516a806bc97831 100644 (file)
@@ -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;