drm/vmwgfx: Add blend mode property
Subsystems (3)
PATCH 1/1 drm/vmwgfx: Add blend mode property
This stops the log spamming introduced by the referenced fixes commit.
--- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +7 -0
@@ -20,10 +20,17 @@#include <drm/drm_rect.h> #include <drm/drm_sysfs.h> #include <drm/drm_edid.h> +#include <drm/drm_blend.h> 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 )); }void vmw_du_cleanup (struct vmw_display_unit *du)
Signature · 1 line
2.55.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
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 <[email protected]>
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.
Quoted 3 lines
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +0
-0
[ ... ]
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c line 34
Quoted 10 lines
void
vmw_du_init(struct vmw_display_unit *du)
{drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +6
-0vmw_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?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1