From: sashiko-bot@kernel.org
To: "Dmitry Baryshkov" <dmitry.baryshkov@oss.qualcomm.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 22/24] drm/msm/dp: stop storing the connector in struct msm_dp
Date: Wed, 22 Jul 2026 07:12:36 +0000 [thread overview]
Message-ID: <20260722071237.136891F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260722-drm-msm-display-interface-v1-22-368c10fe62fd@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [Medium] msm_dp_display_get_connector() returns a connector pointer without holding a reference, violating the DRM iterator API.
Pre-existing issues:
- [High] Missing assignment of `debug->connector` leads to a guaranteed NULL pointer dereference when reading debugfs files.
--
--- Patch [22]: [PATCH 22/24] drm/msm/dp: stop storing the connector in struct msm_dp ---
commit 6517fb125f3c91df434e357450ad362fc4f2fec3
Author: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
drm/msm/dp: stop storing the connector in struct msm_dp
This commit removes the cached drm_connector from struct msm_dp. Instead of
storing the connector, consumers are updated to obtain it from their calling
context, the atomic state, or by looking it up from the encoder.
> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
> --- a/drivers/gpu/drm/msm/dp/dp_display.c
> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
[ ... ]
> @@ -1329,6 +1341,25 @@ bool msm_dp_wide_bus_available(const struct msm_dp *msm_dp_display)
> return dp->wide_bus_supported;
> }
>
> +static struct drm_connector *
> +msm_dp_display_get_connector(struct msm_dp *msm_dp_display)
> +{
> + struct drm_encoder *encoder = msm_dp_display->bridge->encoder;
> + struct drm_connector_list_iter conn_iter;
> + struct drm_connector *connector, *found = NULL;
> +
> + drm_connector_list_iter_begin(msm_dp_display->drm_dev, &conn_iter);
> + drm_for_each_connector_iter(connector, &conn_iter) {
> + if (drm_connector_has_possible_encoder(connector, encoder)) {
> + found = connector;
> + break;
> + }
> + }
> + drm_connector_list_iter_end(&conn_iter);
> +
> + return found;
> +}
[Severity: Medium]
When the loop breaks, drm_connector_list_iter_end() automatically drops the
reference on the current iterator connector. Since drm_connector_get() is not
called on found before returning, does this return a raw pointer without an
elevated reference count?
> +
> void msm_dp_display_debugfs_init(struct msm_dp *msm_dp_display, struct dentry *root, bool is_edp)
> {
> struct msm_dp_display_private *dp;
> @@ -1338,7 +1369,9 @@ void msm_dp_display_debugfs_init(struct msm_dp *msm_dp_display, struct dentry *r
> dp = container_of(msm_dp_display, struct msm_dp_display_private, msm_dp_display);
> dev = &dp->msm_dp_display.pdev->dev;
>
> - rc = msm_dp_debug_init(dev, dp->panel, dp->link, dp->msm_dp_display.connector, root, is_edp);
> + rc = msm_dp_debug_init(dev, dp->panel, dp->link,
> + msm_dp_display_get_connector(msm_dp_display),
> + root, is_edp);
[Severity: High]
This is a pre-existing issue, but I noticed that msm_dp_debug_init() in
dp_debug.c accepts the connector argument but never assigns it to the
allocated debug structure (missing debug->connector = connector).
Later, when a user reads from debugfs nodes like dp_test_active, the show
handlers dereference debug->connector. Since it remains NULL from the
devm_kzalloc() allocation, will reading these debugfs files cause a NULL
pointer dereference?
> if (rc)
> DRM_ERROR("failed to initialize debug, rc = %d\n", rc);
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260722-drm-msm-display-interface-v1-0-368c10fe62fd@oss.qualcomm.com?part=22
next prev parent reply other threads:[~2026-07-22 7:12 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 6:36 [PATCH 00/24] drm/msm: introduce the struct msm_display interface Dmitry Baryshkov
2026-07-22 6:36 ` [PATCH 01/24] drm/msm/dp: reject YUV420-only modes without VSC SDP support Dmitry Baryshkov
2026-07-22 7:03 ` sashiko-bot
2026-07-22 6:36 ` [PATCH 02/24] drm/msm/dp: drop the always-true yuv_supported argument Dmitry Baryshkov
2026-07-22 6:36 ` [PATCH 03/24] drm/msm: create the display connectors from common code Dmitry Baryshkov
2026-07-22 7:04 ` sashiko-bot
2026-07-22 6:36 ` [PATCH 04/24] drm/msm: introduce the struct msm_display interface Dmitry Baryshkov
2026-07-22 6:36 ` [PATCH 05/24] drm/msm: route the display snapshot through the " Dmitry Baryshkov
2026-07-22 6:56 ` sashiko-bot
2026-07-22 6:36 ` [PATCH 06/24] drm/msm/hdmi: capture the HDMI registers in the display snapshot Dmitry Baryshkov
2026-07-22 6:59 ` sashiko-bot
2026-07-22 6:36 ` [PATCH 07/24] drm/msm: add the wide_bus_enabled callback to msm_display Dmitry Baryshkov
2026-07-22 6:36 ` [PATCH 08/24] drm/msm: add the needs_periph_flush " Dmitry Baryshkov
2026-07-22 6:36 ` [PATCH 09/24] drm/msm: add the is_cmd_mode " Dmitry Baryshkov
2026-07-22 6:36 ` [PATCH 10/24] drm/msm: add the get_dsc_config " Dmitry Baryshkov
2026-07-22 6:36 ` [PATCH 11/24] drm/msm: add the get_te_source " Dmitry Baryshkov
2026-07-22 6:36 ` [PATCH 12/24] drm/msm: add is_bonded and needs_encoder callbacks " Dmitry Baryshkov
2026-07-22 6:36 ` [PATCH 13/24] drm/msm/hdmi: use dev_get_drvdata() in msm_hdmi_unbind() Dmitry Baryshkov
2026-07-22 7:03 ` sashiko-bot
2026-07-22 6:36 ` [PATCH 14/24] drm/msm: store the display sub-blocks as struct msm_display Dmitry Baryshkov
2026-07-22 6:36 ` [PATCH 15/24] drm/msm/dp: do not reject wide-bus modes while a YUV420 mode is active Dmitry Baryshkov
2026-07-22 7:03 ` sashiko-bot
2026-07-22 6:36 ` [PATCH 16/24] drm/msm/dp: remove cached drm_edid from panel Dmitry Baryshkov
2026-07-22 7:08 ` sashiko-bot
2026-07-22 6:36 ` [PATCH 17/24] drm/msm/dp: drop deprecated .mode_set() and use .atomic_pre_enable Dmitry Baryshkov
2026-07-22 6:36 ` [PATCH 18/24] drm/msm/hdmi: cache is_hdmi instead of storing the connector Dmitry Baryshkov
2026-07-22 7:06 ` sashiko-bot
2026-07-22 6:36 ` [PATCH 19/24] drm/msm/dp: drop redundant panel->connector Dmitry Baryshkov
2026-07-22 6:36 ` [PATCH 20/24] drm/msm/dp: use drm_display_info in mode_valid callbacks Dmitry Baryshkov
2026-07-22 6:36 ` [PATCH 21/24] drm/msm/dp: guard subconnector setup on the connector type Dmitry Baryshkov
2026-07-22 6:36 ` [PATCH 22/24] drm/msm/dp: stop storing the connector in struct msm_dp Dmitry Baryshkov
2026-07-22 7:12 ` sashiko-bot [this message]
2026-07-22 6:36 ` [PATCH 23/24] drm/msm: create the bridge connectors from common code Dmitry Baryshkov
2026-07-22 7:04 ` sashiko-bot
2026-07-22 6:36 ` [PATCH 24/24] drm/bridge-connector: attach the DP subconnector property Dmitry Baryshkov
2026-07-22 7:05 ` sashiko-bot
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=20260722071237.136891F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=dri-devel@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox