From: sashiko-bot@kernel.org
To: "Maxime Ripard" <mripard@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 40/61] drm/amdgpu_dm: Convert to atomic_create_state
Date: Fri, 14 Aug 2026 15:25:12 +0000 [thread overview]
Message-ID: <20260814152513.5319D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260814-drm-no-more-plane-reset-v2-40-82d2963dd134@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Missing drm_plane_cleanup() on the error path in amdgpu_dm_plane_init() causes a Use-After-Free of the plane object when the caller frees the plane.
--
--- Patch [40]: [PATCH v2 40/61] drm/amdgpu_dm: Convert to atomic_create_state ---
commit 6612d2468dd0e4946eb21b27b9d60498ca111985
Author: Maxime Ripard <mripard@kernel.org>
drm/amdgpu_dm: Convert to atomic_create_state
This commit converts the plane reset implementation to use the
atomic_create_state hook. A custom state subclass is initialized
without resetting any hardware. The conversion was performed via a
Coccinelle semantic patch.
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
[ ... ]
> @@ -1993,9 +1992,16 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
> return res;
> #endif
>
> - /* Create (reset) the plane state */
> - if (plane->funcs->reset)
> - plane->funcs->reset(plane);
> + /* Create the plane state */
> + if (plane->funcs->atomic_create_state) {
> + struct drm_plane_state *plane_state;
> +
> + plane_state = plane->funcs->atomic_create_state(plane);
> + if (IS_ERR(plane_state))
> + return PTR_ERR(plane_state);
[Severity: High]
This is a pre-existing issue, but I wanted to ask about this error path.
If plane->funcs->atomic_create_state() fails and returns an error pointer,
we return the error directly without calling drm_plane_cleanup().
Since drm_universal_plane_init() was called earlier in this function, the
plane is already linked into the mode_config.plane_list. If we return an
error here, the caller initialize_plane() will free the plane memory:
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c:initialize_plane() {
...
if (ret) {
drm_err(adev_to_drm(dm->adev), "KMS: Failed to initialize plane\n");
kfree(plane);
return ret;
}
...
}
Does this leave a freed pointer on the plane list that could cause a
use-after-free later during device teardown in drm_mode_config_cleanup()?
While this problem already existed for dm_plane_init_colorops() failures,
it appears this patch might expose it to a new allocation failure path.
> +
> + plane->state = plane_state;
> + }
>
> return 0;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260814-drm-no-more-plane-reset-v2-0-82d2963dd134@kernel.org?part=40
next prev parent reply other threads:[~2026-08-14 15:25 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 14:56 [PATCH v2 00/61] drm/plane: Convert all drivers to atomic_create_state and remove reset Maxime Ripard
2026-08-14 14:56 ` Maxime Ripard
2026-08-14 14:56 ` [PATCH v2 01/61] drm/simple-kms: Add create_plane_state hook Maxime Ripard
2026-08-14 15:13 ` sashiko-bot
2026-08-14 14:56 ` [PATCH v2 02/61] drm/gem-atomic-helper: Create drm_gem_create_shadow_plane_state() Maxime Ripard
2026-08-14 15:11 ` sashiko-bot
2026-08-14 14:56 ` [PATCH v2 03/61] drm/gem-atomic-helper: Convert simple-kms shadow helpers to create_plane_state Maxime Ripard
2026-08-14 14:56 ` [PATCH v2 04/61] drm/gem-atomic-helper: Switch DRM_GEM_SHADOW_PLANE_FUNCS to atomic_create_state Maxime Ripard
2026-08-14 15:11 ` sashiko-bot
2026-08-14 14:56 ` [PATCH v2 05/61] drm/gem-atomic-helper: Remove drm_gem_reset_shadow_plane() Maxime Ripard
2026-08-14 14:56 ` [PATCH v2 06/61] drm/sysfb: Convert to atomic_create_state Maxime Ripard
2026-08-14 14:56 ` [PATCH v2 07/61] drm/simple-kms: Switch " Maxime Ripard
2026-08-14 15:10 ` sashiko-bot
2026-08-14 14:56 ` [PATCH v2 08/61] drm/ssd130x: Convert " Maxime Ripard
2026-08-14 14:56 ` [PATCH v2 09/61] drm/st7920: " Maxime Ripard
2026-08-14 14:56 ` [PATCH v2 10/61] drm/appletbdrm: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 11/61] drm/vkms: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 12/61] drm/gem-atomic-helper: Remove __drm_gem_reset_shadow_plane() Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 13/61] drm/amdgpu: Convert to atomic_create_state Maxime Ripard
2026-08-14 15:14 ` sashiko-bot
2026-08-14 14:57 ` [PATCH v2 14/61] drm/hdlcd: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 15/61] drm/fsl-dcu: " Maxime Ripard
2026-08-14 15:08 ` sashiko-bot
2026-08-14 14:57 ` [PATCH v2 16/61] drm/hisilicon/kirin: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 17/61] drm/imx/dc: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 18/61] drm/imx/dcss: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 19/61] drm/ingenic: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 20/61] drm/kmb: " Maxime Ripard
2026-08-14 15:14 ` sashiko-bot
2026-08-14 14:57 ` [PATCH v2 21/61] drm/logicvc: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 22/61] drm/loongson: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 23/61] drm/meson: " Maxime Ripard
2026-08-14 14:57 ` Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 24/61] drm/msm/mdp4: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 25/61] drm/lcdif: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 26/61] drm/mxsfb: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 27/61] drm/qxl: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 28/61] drm/rockchip: " Maxime Ripard
2026-08-14 14:57 ` Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 29/61] drm/sprd: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 30/61] drm/sti: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 31/61] drm/stm: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 32/61] drm/sun4i: sun8i: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 33/61] drm/tests: kunit: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 34/61] drm/tilcdc: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 35/61] drm/vboxvideo: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 36/61] drm/verisilicon: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 37/61] drm/virtio: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 38/61] drm/xlnx: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 39/61] drm/atomic-state-helper: Remove drm_atomic_helper_plane_reset() Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 40/61] drm/amdgpu_dm: Convert to atomic_create_state Maxime Ripard
2026-08-14 15:25 ` sashiko-bot [this message]
2026-08-14 14:57 ` [PATCH v2 41/61] drm/komeda: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 42/61] drm/malidp: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 43/61] drm/armada: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 44/61] drm/atmel-hlcdc: Drop spurious csc_init call from reset Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 45/61] drm/atmel-hlcdc: Convert to atomic_create_state Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 46/61] drm/exynos: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 47/61] drm/imx/ipuv3: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 48/61] drm/mediatek: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 49/61] drm/msm/dpu1: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 50/61] drm/msm/mdp5: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 51/61] drm/nouveau: " Maxime Ripard
2026-08-14 14:57 ` Maxime Ripard
2026-08-14 19:06 ` lyude
2026-08-14 14:57 ` [PATCH v2 52/61] drm/omap: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 53/61] drm/rcar-du: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 54/61] drm/rz-du: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 55/61] drm/shmobile: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 56/61] drm/sun4i: layer: " Maxime Ripard
2026-08-14 15:28 ` sashiko-bot
2026-08-14 14:57 ` [PATCH v2 57/61] drm/vc4: " Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 58/61] drm/vmwgfx: " Maxime Ripard
2026-08-14 15:30 ` sashiko-bot
2026-08-14 14:57 ` [PATCH v2 59/61] drm/atomic-state-helper: Remove __drm_atomic_helper_plane_reset() Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 60/61] drm/tegra: Convert to atomic_create_state Maxime Ripard
2026-08-14 14:57 ` [PATCH v2 61/61] drm/plane: Remove reset Maxime Ripard
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=20260814152513.5319D1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=mripard@kernel.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.