Hello Luca,

        Thank you very much for your review and suggestions

> -----邮件原件-----
> 发件人: Luca Ceresoli <[email protected]>
> 发送时间: 2026年12月1日 1:39
> 收件人: Luo Liu <[email protected]>; Maarten Lankhorst
> <[email protected]>; Maxime Ripard <[email protected]>;
> Thomas Zimmermann <[email protected]>; Liviu Dudau
> <[email protected]>; Russell King <[email protected]>;
> [email protected]
> 抄送: Ayan Halder <[email protected]>; Andrzej Hajda
> <[email protected]>; Neil Armstrong <[email protected]>;
> Robert Foss <[email protected]>; Laurent Pinchart
> <[email protected]>; Jonas Karlman <[email protected]>;
> Jernej Skrabec <[email protected]>; Kory Maincent
> <[email protected]>; Luca Ceresoli <[email protected]>;
> David Airlie <[email protected]>; Simona Vetter <[email protected]>;
> [email protected]; cix-kernel-upstream
> <[email protected]>; Wuyi Shen (沈武义)
> <[email protected]>
> 主题: Re: [PATCH v4 3/4] drm/komeda: Free the IRQ before clearing dev_private
>
> [Some people who received this message don't often get email from
> [email protected]. Learn why this is important at
> https://aka.ms/LearnAboutSenderIdentification ]
>
> EXTERNAL EMAIL
>
> On Mon Nov 30, 2026 at 3:55 AM CET, Luo Liu 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")
> > Signed-off-by: Luo Liu <[email protected]>
> > ---
> >  drivers/gpu/drm/arm/display/komeda/komeda_kms.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
> > b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
> > index 37388d45b31f..4fabe1aba25f 100644
> > --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
> > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
> > @@ -334,6 +334,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;
> > @@ -348,6 +349,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;
> >  }
>
> I understand this is a simple and quick fix, so it's kind of OK.
>
> However dev_private is deprecated [0]. Would you consider improving the
> driver to use the recommended practice?
>
> [0]
> https://elixir.bootlin.com/linux/v7.4-rc2/source/include/drm/drm_device.h#L12
> 6-L136


I will address this in a separate series: it will move komeda away
from drm->dev_private, and it will also cover the dev_err_probe()
points you raised on patches 1 and 2. I would like to keep this series
unchanged for now, since it is a small fix with a Fixes: tag and I
would prefer to keep it easy to backport.

Best regards,
Luo

>
> Luca
>
> --
> Luca Ceresoli, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com


本邮件及其附件包含CIX公司的保密信息,受法律保护,仅供本邮件指定的收件人查阅。严禁任何未经授权的使用、传播、分发或复制本邮件及其任何内容。此限制适用于指定收件人以外的所有人员,包括未经明确授权处理此类信息的CIX公司员工或代理人。若您误收本邮件,请立即通知发件人,并永久删除邮件及所有附件。互联网传输无法保证及时性、安全性、完整性和无病毒性,CIX公司对任何传输错误或遗漏概不承担责任。

Reply via email to