From: Devarsh Thakkar <devarsht@xxxxxx> commit a9a73f2661e6f625d306c9b0ef082e4593f45a21 upstream. The driver has a spinlock for protecting the irq_masks field and irq enable registers. However, the driver misses protecting the irq status registers which can lead to races. Take the spinlock when accessing irqstatus too. Fixes: 32a1795f57ee ("drm/tidss: New driver for TI Keystone platform Display SubSystem") Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Devarsh Thakkar <devarsht@xxxxxx> [Tomi: updated the desc] Reviewed-by: Jonathan Cormier <jcormier@xxxxxxxxxxxxxxxx> Tested-by: Jonathan Cormier <jcormier@xxxxxxxxxxxxxxxx> Reviewed-by: Aradhya Bhatia <aradhya.bhatia@xxxxxxxxx> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@xxxxxxxxxxxxxxxx> Link: https://patchwork.freedesktop.org/patch/msgid/20241021-tidss-irq-fix-v1-6-82ddaec94e4a@xxxxxxxxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/tidss/tidss_dispc.c | 4 ++++ drivers/gpu/drm/tidss/tidss_irq.c | 2 ++ 2 files changed, 6 insertions(+) --- a/drivers/gpu/drm/tidss/tidss_dispc.c +++ b/drivers/gpu/drm/tidss/tidss_dispc.c @@ -2763,8 +2763,12 @@ static void dispc_init_errata(struct dis */ static void dispc_softreset_k2g(struct dispc_device *dispc) { + unsigned long flags; + + spin_lock_irqsave(&dispc->tidss->wait_lock, flags); dispc_set_irqenable(dispc, 0); dispc_read_and_clear_irqstatus(dispc); + spin_unlock_irqrestore(&dispc->tidss->wait_lock, flags); for (unsigned int vp_idx = 0; vp_idx < dispc->feat->num_vps; ++vp_idx) VP_REG_FLD_MOD(dispc, vp_idx, DISPC_VP_CONTROL, 0, 0, 0); --- a/drivers/gpu/drm/tidss/tidss_irq.c +++ b/drivers/gpu/drm/tidss/tidss_irq.c @@ -60,7 +60,9 @@ static irqreturn_t tidss_irq_handler(int unsigned int id; dispc_irq_t irqstatus; + spin_lock(&tidss->wait_lock); irqstatus = dispc_read_and_clear_irqstatus(tidss->dispc); + spin_unlock(&tidss->wait_lock); for (id = 0; id < tidss->num_crtcs; id++) { struct drm_crtc *crtc = tidss->crtcs[id]; Patches currently in stable-queue which might be from devarsht@xxxxxx are queue-6.12/drm-tidss-clear-the-interrupt-status-for-interrupts-being-disabled.patch queue-6.12/drm-tidss-fix-issue-in-irq-handling-causing-irq-flood-issue.patch queue-6.12/drm-tidss-fix-race-condition-while-handling-interrupt-registers.patch