drm/msm/dpu: Add callback function pointer check before its call
authorAleksandr Mishin <amishin@t-argos.ru>
Mon, 8 Apr 2024 08:55:23 +0000 (11:55 +0300)
committerDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Tue, 23 Apr 2024 09:56:30 +0000 (12:56 +0300)
In dpu_core_irq_callback_handler() callback function pointer is compared to NULL,
but then callback function is unconditionally called by this pointer.
Fix this bug by adding conditional return.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: c929ac60b3ed ("drm/msm/dpu: allow just single IRQ callback")
Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/588237/
Link: https://lore.kernel.org/r/20240408085523.12231-1-amishin@t-argos.ru
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c

index 6a0a74832fb64d95adc6b0524ba15bd1faaa0bb1..b85881aab04786733aa46c23303db45ad592228b 100644 (file)
@@ -223,9 +223,11 @@ static void dpu_core_irq_callback_handler(struct dpu_kms *dpu_kms, unsigned int
 
        VERB("IRQ=[%d, %d]\n", DPU_IRQ_REG(irq_idx), DPU_IRQ_BIT(irq_idx));
 
-       if (!irq_entry->cb)
+       if (!irq_entry->cb) {
                DRM_ERROR("no registered cb, IRQ=[%d, %d]\n",
                          DPU_IRQ_REG(irq_idx), DPU_IRQ_BIT(irq_idx));
+               return;
+       }
 
        atomic_inc(&irq_entry->count);