All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Luo Liu" <Luo.Liu@cixtech.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/komeda: Use drmm_mode_config_init()
Date: Tue, 24 Nov 2026 07:03:15 +0000	[thread overview]
Message-ID: <sashiko-outbox-230617@kernel.org> (raw)
In-Reply-To: <20261124065446.3107248-3-Luo.Liu@cixtech.com>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] drm/komeda: null pointer dereference in
  komeda_kms_irq_handler() [1]
--

commit 0e65e87085171dcf76021a4ce18f9f49413797fc
Author: Luo Liu <Luo.Liu@cixtech.com>

drm/komeda: Use drmm_mode_config_init()

This commit switches komeda to drmm_mode_config_init(), drops explicit
drm_mode_config_cleanup() calls, and updates
komeda_kms_cleanup_private_objs() to walk pipelines instead of
mode_config.privobj_list.

> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
> index faa8b041373a7..37388d45b31f2 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c

[ ... ]

> @@ -315,7 +322,7 @@ struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev)
>  			       komeda_kms_irq_handler, IRQF_SHARED,
>  			       drm->driver->name, drm);
>  	if (err)
> -		goto cleanup_mode_config;
> +		goto cleanup_private_objs;
>  
>  	drm_kms_helper_poll_init(drm);
>  
> @@ -327,9 +334,8 @@ struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev)
>  
>  free_interrupts:
>  	drm_kms_helper_poll_fini(drm);
> -cleanup_mode_config:
> -	drm_mode_config_cleanup(drm);
> -	komeda_kms_cleanup_private_objs(kms);
> +cleanup_private_objs:
> +	komeda_kms_cleanup_private_objs(mdev);
>  	drm->dev_private = NULL;
>  	return ERR_PTR(err);
>  }
> @@ -337,12 +343,12 @@ struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev)
>  void komeda_kms_detach(struct komeda_kms_dev *kms)
>  {
>  	struct drm_device *drm = &kms->base;
> +	struct komeda_dev *mdev = drm->dev_private;
>  
>  	drm_dev_unregister(drm);
>  	drm_kms_helper_poll_fini(drm);
>  	drm_atomic_helper_shutdown(drm);
> -	drm_mode_config_cleanup(drm);
> -	komeda_kms_cleanup_private_objs(kms);
> +	komeda_kms_cleanup_private_objs(mdev);
>  	drm->dev_private = NULL;
>  }

[Severity: High]
This problem wasn't introduced by this patch, but can clearing
drm->dev_private here cause a NULL pointer dereference in
komeda_kms_irq_handler() [1]?

The IRQ is registered with IRQF_SHARED via devm_request_irq(), so it stays
active until devres cleanup runs after komeda_kms_attach() fails or
komeda_kms_detach() returns.  If another device on the shared line raises
an interrupt after drm->dev_private is set to NULL,
komeda_kms_irq_handler() dereferences mdev:

drivers/gpu/drm/arm/display/komeda/komeda_kms.c:komeda_kms_irq_handler() {
	struct drm_device *drm = data;
	struct komeda_dev *mdev = drm->dev_private;
	...
	status = mdev->funcs->irq_handler(mdev, &evts);
}

[1] https://sashiko.dev/#/bug/linux-7f3e9b9f-7fcd-447d-9114-8e6de2954834

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261124065446.3107248-1-Luo.Liu@cixtech.com?part=2

      reply	other threads:[~2026-11-24  7:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24  6:54 [PATCH 0/2] drm/komeda: Use the bridge connector Luo Liu
2026-11-24  6:54 ` [PATCH 1/2] " Luo Liu
2026-11-24  7:18   ` sashiko-bot
2026-11-24  6:54 ` [PATCH 2/2] drm/komeda: Use drmm_mode_config_init() Luo Liu
2026-11-24  7:03   ` sashiko-bot [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=sashiko-outbox-230617@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Luo.Liu@cixtech.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.