From: Luo Liu <Luo.Liu@cixtech.com>
To: Luca Ceresoli <luca.ceresoli@bootlin.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
Liviu Dudau <liviu.dudau@arm.com>,
Russell King <linux@armlinux.org.uk>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>
Cc: "Ayan Halder" <Ayan.Halder@arm.com>,
"Andrzej Hajda" <andrzej.hajda@intel.com>,
"Neil Armstrong" <neil.armstrong@linaro.org>,
"Robert Foss" <rfoss@kernel.org>,
"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
"Jonas Karlman" <jonas@kwiboo.se>,
"Jernej Skrabec" <jernej.skrabec@gmail.com>,
"Kory Maincent" <kory.maincent@bootlin.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
cix-kernel-upstream <cix-kernel-upstream@cixtech.com>,
"Wuyi Shen (沈武义)" <wuyi.shen@cixtech.com>
Subject: 回复: [PATCH v4 3/4] drm/komeda: Free the IRQ before clearing dev_private
Date: Tue, 1 Dec 2026 02:47:28 +0000 [thread overview]
Message-ID: <JH0SPRMB00748FC07EB621FF059BC87FF54D2@JH0SPRMB0074.apcprd06.prod.outlook.com> (raw)
In-Reply-To: <DN8Q8ZKMYOXM.HQ5VXL2J3EZ@bootlin.com>
Hello Luca,
Thank you very much for your review and suggestions
> -----邮件原件-----
> 发件人: Luca Ceresoli <luca.ceresoli@bootlin.com>
> 发送时间: 2026年12月1日 1:39
> 收件人: Luo Liu <Luo.Liu@cixtech.com>; Maarten Lankhorst
> <maarten.lankhorst@linux.intel.com>; Maxime Ripard <mripard@kernel.org>;
> Thomas Zimmermann <tzimmermann@suse.de>; Liviu Dudau
> <liviu.dudau@arm.com>; Russell King <linux@armlinux.org.uk>;
> dri-devel@lists.freedesktop.org
> 抄送: Ayan Halder <Ayan.Halder@arm.com>; Andrzej Hajda
> <andrzej.hajda@intel.com>; Neil Armstrong <neil.armstrong@linaro.org>;
> Robert Foss <rfoss@kernel.org>; Laurent Pinchart
> <laurent.pinchart@ideasonboard.com>; Jonas Karlman <jonas@kwiboo.se>;
> Jernej Skrabec <jernej.skrabec@gmail.com>; Kory Maincent
> <kory.maincent@bootlin.com>; Luca Ceresoli <luca.ceresoli@bootlin.com>;
> David Airlie <airlied@gmail.com>; Simona Vetter <simona@ffwll.ch>;
> linux-kernel@vger.kernel.org; cix-kernel-upstream
> <cix-kernel-upstream@cixtech.com>; Wuyi Shen (沈武义)
> <Wuyi.Shen@cixtech.com>
> 主题: 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
> luca.ceresoli@bootlin.com. 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 <Luo.Liu@cixtech.com>
> > ---
> > 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
next prev parent reply other threads:[~2026-12-01 2:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 2:55 [PATCH v4 1/4] drm/komeda: Use the bridge connector Luo Liu
2026-11-30 2:55 ` [PATCH v4 2/4] drm/komeda: Use drmm_mode_config_init() Luo Liu
2026-11-30 13:25 ` Liviu Dudau
2026-11-30 2:55 ` [PATCH v4 3/4] drm/komeda: Free the IRQ before clearing dev_private Luo Liu
2026-11-30 13:27 ` Liviu Dudau
2026-11-30 17:38 ` Luca Ceresoli
2026-12-01 2:47 ` Luo Liu [this message]
2026-11-30 2:55 ` [PATCH v4 4/4] drm/bridge: tda998x: fix DRM_BRIDGE_ATTACH_NO_CONNECTOR support Luo Liu
2026-11-30 14:32 ` Liviu Dudau
2026-11-30 9:53 ` [PATCH v4 1/4] drm/komeda: Use the bridge connector Kory Maincent
2026-11-30 11:45 ` 回复: " Luo Liu
2026-11-30 13:23 ` Liviu Dudau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=JH0SPRMB00748FC07EB621FF059BC87FF54D2@JH0SPRMB0074.apcprd06.prod.outlook.com \
--to=luo.liu@cixtech.com \
--cc=Ayan.Halder@arm.com \
--cc=airlied@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=cix-kernel-upstream@cixtech.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=kory.maincent@bootlin.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=liviu.dudau@arm.com \
--cc=luca.ceresoli@bootlin.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=rfoss@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
--cc=wuyi.shen@cixtech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®