mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Liviu Dudau <liviu.dudau@arm.com>
To: Luca Ceresoli <luca.ceresoli@bootlin.com>
Cc: Luo Liu <Luo.Liu@cixtech.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	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>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	linux-kernel@vger.kernel.org, cix-kernel-upstream@cixtech.com,
	Wuyi.Shen@cixtech.com
Subject: Re: [PATCH v6 3/3] drm/komeda: Free the IRQ before clearing dev_private
Date: Tue, 1 Dec 2026 09:13:18 +0000	[thread overview]
Message-ID: <aw6PrpQzB0cU2lYl@e142607> (raw)
In-Reply-To: <179611484744.647574.2802243177232479190.b4-review@b4>

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 <liviu.dudau@arm.com>
> > Signed-off-by: Luo Liu <Luo.Liu@cixtech.com>
> >
> > 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 <luca.ceresoli@bootlin.com>
> 
> 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	other threads:[~2026-12-01  9:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  3:24 [PATCH v6 0/3] drm/komeda: use the bridge connector Luo Liu
2026-12-01  3:24 ` [PATCH v6 1/3] drm/komeda: Use drmm_mode_config_init() Luo Liu
2026-12-01  8:47   ` Luca Ceresoli
2026-12-01  3:24 ` [PATCH v6 2/3] drm/komeda: Use the bridge connector Luo Liu
2026-12-01  3:24 ` [PATCH v6 3/3] drm/komeda: Free the IRQ before clearing dev_private Luo Liu
2026-12-01  8:47   ` Luca Ceresoli
2026-12-01  9:13     ` Liviu Dudau [this message]

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=aw6PrpQzB0cU2lYl@e142607 \
    --to=liviu.dudau@arm.com \
    --cc=Ayan.Halder@arm.com \
    --cc=Luo.Liu@cixtech.com \
    --cc=Wuyi.Shen@cixtech.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=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 \
    /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®