All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ian Forbes" <ian.forbes@broadcom.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/vmwgfx: Add blend mode property
Date: Fri, 11 Sep 2026 18:05:39 +0000	[thread overview]
Message-ID: <20260911180540.40FDC1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260911175607.1127474-1-ian.forbes@broadcom.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Missing drm_plane_cleanup() on error paths in display unit initialization functions leads to list corruption and use-after-free.
--

commit dea10d2954fcbf7f9f6713f8f44088d76a62295e
Author: Ian Forbes <ian.forbes@broadcom.com>

drm/vmwgfx: Add blend mode property

This commit adds blend mode properties to the primary and cursor planes to 
stop log spamming. It initializes the properties in vmw_du_init() for both
planes if they are present.

> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
[ ... ]
>  void vmw_du_init(struct vmw_display_unit *du)
>  {
>  	vmw_vkms_crtc_init(&du->crtc);
> +	drm_plane_create_blend_mode_property(&du->primary,
> +					     BIT(DRM_MODE_BLEND_PIXEL_NONE));
> +	// Check that the cursor plane was actually initialized
> +	if (du->crtc.cursor == &du->cursor.base)
> +		drm_plane_create_blend_mode_property(&du->cursor.base,
> +						     BIT(DRM_MODE_BLEND_PREMULTI));
>  }

[Severity: High]
This isn't a bug introduced by this patch, but I noticed a pre-existing
issue regarding the cleanup of these planes on error paths during display unit
initialization.

In functions like vmw_ldu_init(), vmw_sou_init(), and vmw_stdu_init(), the
primary and cursor planes are initialized, which links them into the DRM
core plane list. If a subsequent step like drm_connector_init() fails, the
code jumps to an error label and frees the display unit structure without
cleaning up the planes:

drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c:vmw_ldu_init() {
...
	ret = drm_connector_init(dev, connector, &vmw_legacy_connector_funcs,
				 DRM_MODE_CONNECTOR_VIRTUAL);
	if (ret) {
		DRM_ERROR("Failed to initialize connector\n");
		goto err_free;
	}
...
err_free:
	kfree(ldu);
	return ret;
}

Similar error paths exist in vmw_sou_init() for the sou structure, and
vmw_stdu_init() for the stdu structure.

Since the display unit structure containing the planes is freed with kfree()
but drm_plane_cleanup() hasn't been called, could this leave dangling
pointers in the DRM core plane list? If the list is later traversed during
driver teardown in drm_mode_config_cleanup(), wouldn't this result in a
use-after-free? 

Should these error paths be updated to call drm_plane_cleanup() or a similar
teardown helper before freeing the memory?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260911175607.1127474-1-ian.forbes@broadcom.com?part=1

      reply	other threads:[~2026-09-11 18:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-11 17:56 [PATCH] drm/vmwgfx: Add blend mode property Ian Forbes
2026-09-11 18:05 ` 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=20260911180540.40FDC1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ian.forbes@broadcom.com \
    --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.