From: yzddMr6 via B4 Relay <devnull+yzddmr6.gmail.com@kernel.org>
To: Rob Clark <robin.clark@oss.qualcomm.com>,
Dmitry Baryshkov <lumag@kernel.org>
Cc: Abhinav Kumar <abhinav.kumar@linux.dev>,
Jessica Zhang <jesszhan0024@gmail.com>,
Sean Paul <sean@poorly.run>,
Marijn Suijten <marijn.suijten@somainline.org>,
David Airlie <airlied@gmail.com>,
Simona Vetter <simona@ffwll.ch>,
Miaoqian Lin <linmq006@gmail.com>,
Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org,
yzddMr6 <yzddmr6@gmail.com>
Subject: [PATCH] drm/msm/dsi: Fix double put of the PHY device on probe deferral
Date: Fri, 20 Nov 2026 21:12:58 +0800 [thread overview]
Message-ID: <20261120-upstream2-msm-dsi-phy-ref-v1-1-d267b87d545f@gmail.com> (raw)
From: yzddMr6 <yzddmr6@gmail.com>
Since commit 6977cc89c875 ("drm/msm/dsi: Fix some reference counted
resource leaks"), dsi_get_phy() stores the PHY device it looked up in
msm_dsi->phy_dev before it checks whether the PHY driver has bound, and
dsi_destroy() drops that reference. dsi_init() calls dsi_destroy() when
dsi_get_phy() fails.
Commit c04c3148ca12 ("drm/msm/dsi: Fix missing put_device() call in
dsi_get_phy") then added a put_device() for the case where the PHY
device exists but has no driver data yet. In that case the reference is
now dropped twice, once in dsi_get_phy() and again in dsi_destroy(), so
each probe deferral for this reason takes one reference too many from
the PHY platform device. Enough deferrals underflow its refcount and
free it while it is still registered.
fw_devlink normally keeps the DSI host from probing before its PHY has
bound. The path is reached with fw_devlink=permissive or off, and after
the deferred probe timeout when no driver matches the PHY device, as
the device link is relaxed then and every probe retry of the DSI host
drops another reference.
Drop the put_device() and leave the reference to dsi_destroy(). This
effectively reverts that commit and brings back the single check that
it split in two.
The double put was found with the help of an AI coding assistant during
a review of the driver.
Fixes: c04c3148ca12 ("drm/msm/dsi: Fix missing put_device() call in dsi_get_phy")
Signed-off-by: yzddMr6 <yzddmr6@gmail.com>
---
Found by reading the code; I have not hit this on hardware, and there
is no reproducer. Build-tested only: drivers/gpu/drm/msm/ with W=1
(arm64 defconfig) on the base commit below, no new warnings.
I used an AI coding assistant for this work. It found the double put
while reviewing the driver and drafted this patch and changelog. I have
reviewed the change.
---
drivers/gpu/drm/msm/dsi/dsi.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c
index 090726be5061..5f9a1409432a 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.c
+++ b/drivers/gpu/drm/msm/dsi/dsi.c
@@ -44,12 +44,7 @@ static int dsi_get_phy(struct msm_dsi *msm_dsi)
of_node_put(phy_node);
- if (!phy_pdev) {
- DRM_DEV_ERROR(&pdev->dev, "%s: phy driver is not ready\n", __func__);
- return -EPROBE_DEFER;
- }
- if (!msm_dsi->phy) {
- put_device(&phy_pdev->dev);
+ if (!phy_pdev || !msm_dsi->phy) {
DRM_DEV_ERROR(&pdev->dev, "%s: phy driver is not ready\n", __func__);
return -EPROBE_DEFER;
}
---
base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3
change-id: 20261120-upstream2-msm-dsi-phy-ref-bef3dce3dfe6
Best regards,
--
yzddMr6 <yzddmr6@gmail.com>
reply other threads:[~2026-11-20 13:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261120-upstream2-msm-dsi-phy-ref-v1-1-d267b87d545f@gmail.com \
--to=devnull+yzddmr6.gmail.com@kernel.org \
--cc=abhinav.kumar@linux.dev \
--cc=airlied@gmail.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=jesszhan0024@gmail.com \
--cc=linmq006@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lumag@kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=robin.clark@oss.qualcomm.com \
--cc=sean@poorly.run \
--cc=simona@ffwll.ch \
--cc=yzddmr6@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®