From: sashiko-bot@kernel.org
To: "Suraj Kandpal" <suraj.kandpal@intel.com>,
dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Cc: wsa+renesas@sang-engineering.com
Subject: Re: [PATCH v8 1/7] drm: writeback: Refactor drm_writeback_connector structure
Date: Thu, 26 Nov 2026 04:47:25 +0000 [thread overview]
Message-ID: <sashiko-outbox-234745@kernel.org> (raw)
In-Reply-To: <20261126042835.436307-2-suraj.kandpal@intel.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] drm: union aliasing of hdmi and writeback in
drm_connector_cleanup()
- [Low] drm/komeda: leftover to_wb_conn() macro referencing removed base
field
--
commit 66ee0f80dc4646656a302b2a96d37078327b91b5
Author: Suraj Kandpal <suraj.kandpal@intel.com>
drm: writeback: Refactor drm_writeback_connector structure
This commit embeds struct drm_writeback_connector inside struct
drm_connector (in a union with struct drm_connector_hdmi) instead of
embedding struct drm_connector inside struct drm_writeback_connector, and
updates the writeback drivers accordingly.
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c b/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c
> index ea4589b00ee0f..07075a8b5aa8e 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c
> @@ -52,7 +52,7 @@ komeda_wb_encoder_atomic_check(struct drm_encoder *encoder,
> return -EINVAL;
> }
>
> - wb_layer = to_kconn(to_wb_conn(conn_st->connector))->wb_layer;
> + wb_layer = to_kconn(conn_st->connector)->wb_layer;
[Severity: Low]
Should the unused to_wb_conn() macro in
drivers/gpu/drm/arm/display/komeda/komeda_kms.h be removed as well? It
still references the removed base field of struct drm_writeback_connector:
drivers/gpu/drm/arm/display/komeda/komeda_kms.h:
#define to_wb_conn(x) container_of(x, struct drm_writeback_connector, base)
[ ... ]
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index 07218ab26c9e6..2f9dd780809fc 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
[ ... ]
> @@ -2691,19 +2746,24 @@ struct drm_connector {
> /**
> * @wb_initialized:
> *
> - * Set when the connector is embedded in a &struct
> - * drm_writeback_connector that has been initialized through
> + * Set when @writeback has been initialized through
> * __drm_writeback_connector_init(). A plain &struct drm_connector may
> * be created with DRM_MODE_CONNECTOR_WRITEBACK without being a
> * writeback connector, so drm_connector_cleanup() keys the writeback
> * teardown off this flag rather than the connector type.
> */
> bool wb_initialized;
>
> - /**
> - * @hdmi: HDMI-related variable and properties.
> - */
> - struct drm_connector_hdmi hdmi;
> + union {
> + /**
> + * @hdmi: HDMI-related variable and properties.
> + */
> + struct drm_connector_hdmi hdmi;
> + /**
> + * @writeback: Writeback related valriables.
> + */
> + struct drm_writeback_connector writeback;
> + };
[Severity: High]
Can placing connector->hdmi and connector->writeback in a union corrupt
memory during writeback connector teardown in drm_connector_cleanup()?
drm_connector_init_only() unconditionally initializes
connector->hdmi.infoframes.lock for all connectors, after which
__drm_writeback_connector_init() initializes connector->writeback in the
same union storage. When the writeback connector is later cleaned up,
drm_connector_cleanup() unconditionally touches connector->hdmi fields
before and after drm_writeback_connector_cleanup():
drivers/gpu/drm/drm_connector.c:drm_connector_cleanup() {
...
if (connector->hdmi.scdc_work_initialized)
cancel_delayed_work_sync(&connector->hdmi.scdc_work);
if (connector->wb_initialized)
drm_writeback_connector_cleanup(connector);
...
mutex_destroy(&connector->hdmi_audio.lock);
mutex_destroy(&connector->hdmi.infoframes.lock);
mutex_destroy(&connector->mutex);
...
}
When spinlock_t is enlarged (for example with CONFIG_DEBUG_SPINLOCK or
CONFIG_PREEMPT_RT), the fields of struct drm_writeback_connector
(including job_lock, job_queue, fence_lock, and timeline_name) overlap
connector->hdmi.scdc_work, connector->hdmi.scdc_work_initialized, and
connector->hdmi.infoframes.lock. Populating connector->writeback can set
connector->hdmi.scdc_work_initialized to a non-zero byte and overwrite the
work and mutex structures, causing drm_connector_cleanup() to pass
writeback fields to cancel_delayed_work_sync() and mutex_destroy().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261126042835.436307-1-suraj.kandpal@intel.com?part=1
next prev parent reply other threads:[~2026-11-26 4:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 4:28 [PATCH v8 0/7] Refactor drm_writeback_connector structure Suraj Kandpal
2026-11-26 4:28 ` [PATCH v8 1/7] drm: writeback: " Suraj Kandpal
2026-11-26 4:47 ` sashiko-bot [this message]
2026-11-26 4:28 ` [PATCH v8 2/7] drm: writeback: Modify writeback init helpers Suraj Kandpal
2026-11-26 4:28 ` [PATCH v8 3/7] drm: writeback: Modify drm_writeback_queue_job helper Suraj Kandpal
2026-11-26 4:28 ` [PATCH v8 4/7] drm: writeback: Modify drm_writeback_signal_completion helper Suraj Kandpal
2026-11-26 4:28 ` [PATCH v8 5/7] drm: writeback: Modify drm_writeback_get_out_fence helper Suraj Kandpal
2026-11-26 4:28 ` [PATCH v8 6/7] drm: writeback: Modify prepare_writeback_job helper Suraj Kandpal
2026-11-26 4:28 ` [PATCH v8 7/7] drm: writeback: Modify cleanup_writeback_job helper Suraj Kandpal
2026-11-26 4:36 ` ✗ CI.checkpatch: warning for Refactor drm_writeback_connector structure (rev9) Patchwork
2026-11-26 4:38 ` ✓ CI.KUnit: success " Patchwork
2026-11-26 5:18 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-26 5:40 ` ✗ i915.CI.BAT: failure " Patchwork
2026-11-26 6:19 ` [PATCH v8 0/7] Refactor drm_writeback_connector structure Kandpal, Suraj
2026-11-26 11:33 ` ✓ Xe.CI.FULL: success for Refactor drm_writeback_connector structure (rev9) Patchwork
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-234745@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=suraj.kandpal@intel.com \
--cc=wsa+renesas@sang-engineering.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.