All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yaohan Li" <shunsheng1218@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [RFC PATCH v2 1/2] drm/msm: release the cursor flip work before the KMS is torn down
Date: Thu, 19 Nov 2026 08:48:13 +0000	[thread overview]
Message-ID: <sashiko-outbox-222715@kernel.org> (raw)
In-Reply-To: <20261119083133.3437277-1-shunsheng1218@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/msm/mdp4: mdp4_kms->dev dereferenced before NULL check in
  mdp4_destroy()
--

commit 26c33f96a5c574b9e64b260a7b6a74a4cfcc0b65
Author: Yaohan Li <shunsheng1218@gmail.com>

drm/msm: release the cursor flip work before the KMS is torn down

This commit releases the DRM-managed cursor flip work cleanup action from
mdp4_destroy() and mdp5_kms_destroy() before the KMS VM is destroyed.

> diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c
> index ab7b62381685f..3fd528eeff0e3 100644
> --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c
> +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c
> @@ -136,6 +136,19 @@ static void mdp4_destroy(struct msm_kms *kms)
>  {
>  	struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms));
>  	struct device *dev = mdp4_kms->dev->dev;
> +	struct drm_crtc *crtc;
> +
> +	/*
> +	 * Release the cursor flip work while the VM is still alive.  The
> +	 * cleanup is registered as a DRM-managed action, so it would only run
> +	 * at the final drm_dev_put(), long after drm_gpuvm_put() below has
> +	 * destroyed the VM that unref_cursor_worker() needs.  The interrupts
> +	 * and the KMS workqueue have been stopped at this point, so no new
> +	 * cursor update can be queued any more.
> +	 */
> +	if (mdp4_kms->dev)
> +		drm_for_each_crtc(crtc, mdp4_kms->dev)
> +			mdp4_crtc_release_flip_work(crtc);

[Severity: Medium]
Can the new NULL check on mdp4_kms->dev ever protect against a NULL
mdp4_kms->dev when mdp4_kms->dev->dev is dereferenced right at the top of
mdp4_destroy()?

In mdp4_kms_init(), mdp_kms_init() -> msm_kms_init() sets kms->funcs before
mdp4_kms->dev is assigned, so if msm_kms_init() fails afterwards,
msm_drm_kms_uninit() calls mdp4_destroy() with mdp4_kms->dev == NULL and
triggers a NULL pointer dereference before reaching the new guard (while
dev is only used later under if (mdp4_kms->rpm_enabled)).

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261119083133.3437277-1-shunsheng1218@gmail.com?part=1

  parent reply	other threads:[~2026-11-19  8:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19  2:36 [RFC PATCH] drm/flip: drain the flip work on cleanup Yaohan Li
2026-11-19  2:51 ` sashiko-bot
2026-11-19  8:31 ` [RFC PATCH v2 1/2] drm/msm: release the cursor flip work before the KMS is torn down Yaohan Li
2026-11-19  8:31   ` Yaohan Li
2026-11-19  8:31   ` [RFC PATCH v2 2/2] drm/flip: drain the flip work on cleanup Yaohan Li
2026-11-19  8:31     ` Yaohan Li
2026-11-19  8:48   ` sashiko-bot [this message]
2026-11-19 11:18     ` [RFC PATCH v2 1/2] drm/msm: release the cursor flip work before the KMS is torn down Yaohan Li

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-222715@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=shunsheng1218@gmail.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 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.