On Tue, Dec 01, 2026 at 09:47:27AM +0100, Luca Ceresoli wrote:
> > The interrupt is requested with devm_request_irq(), so it remains
> > registered until the device is removed and its devres resources are
> > released. komeda_kms_detach(), and the komeda_kms_attach() error path
> > taken when drm_dev_register() fails, clear drm->dev_private before that,
> > while komeda_kms_irq_handler() still reads mdev from it. The interrupt
> > line is shared, so another device can raise it in that window and make
> > the handler dereference a NULL pointer.
> >
> > Free the interrupt explicitly with devm_free_irq() before dropping
> > drm->dev_private. free_irq() removes the action and synchronizes with
> > any handler in flight, so the handler cannot run afterwards.
> >
> > Fixes: 2cfb1981dd0d ("drm/komeda: Make Komeda interrupts shareable")
> > Reviewed-by: Liviu Dudau <[email protected]>
> > Signed-off-by: Luo Liu <[email protected]>
> >
> > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c 
> > b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
> > index f55770511276..ebf4459eb209 100644
> > --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
> > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
> > @@ -336,6 +336,7 @@ struct komeda_kms_dev *komeda_kms_attach(struct 
> > komeda_dev *mdev)
> >
> >  free_interrupts:
> >     drm_kms_helper_poll_fini(drm);
> > +   devm_free_irq(drm->dev, mdev->irq, drm);
> >  cleanup_private_objs:
> >     komeda_kms_cleanup_private_objs(mdev);
> >     drm->dev_private = NULL;
> > @@ -350,6 +351,8 @@ void komeda_kms_detach(struct komeda_kms_dev *kms)
> >     drm_dev_unregister(drm);
> >     drm_kms_helper_poll_fini(drm);
> >     drm_atomic_helper_shutdown(drm);
> > +   /* The handler dereferences drm->dev_private, which is about to go. */
> > +   devm_free_irq(drm->dev, mdev->irq, drm);
> >     komeda_kms_cleanup_private_objs(mdev);
> >     drm->dev_private = NULL;
> >  }
> 
> The patch looks ok:
> 
> Reviewed-by: Luca Ceresoli <[email protected]>
> 
> However it's better if you send fixes in a separate series as suggested by
> Köry in v4. But if you send them in the same series, at least have fixes
> before features. This is because in DRM fixes are applied to a different
> branch, so a fix after a feature patch might just fail to apply.

Yeah, but we're in -rc5 now and the fixes are not critical, so I'll push the
whole series into drm-misc-next. Stable will pick the fixes up once they get
merged into a public release.

Best regards,
Liviu

> 
> This was a suggestion for future series. For this series, I'd not add more
> noise by splitting this patch into yet another sub-series. oving it as the
> first patch should be enough.
> 
> Luca
> 
> -- 
> Luca Ceresoli, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
> 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

Reply via email to