From: Yige Jiang <yigejiang86@gmail.com>
To: Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>
Cc: Yige Jiang <yigejiang86@gmail.com>,
Abel Vesa <abelvesa@kernel.org>,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: [PATCH] soc: qcom: llcc-qcom: Unregister the EDAC device on unbind
Date: Thu, 3 Dec 2026 03:15:46 +0800 [thread overview]
Message-ID: <20261202233909.fe2f84b3eae2.llcc-edac@gmail.com> (raw)
qcom_llcc_probe() registers the qcom_llcc_edac platform device but
keeps the returned pointer only in a local variable. Nothing unregisters
the child when the LLCC driver is unbound.
The child's platform data contains pointers to the LLCC device's
managed regmaps. Those are freed on unbind while the EDAC device
remains bound, so its polling work or interrupt handler can access
freed memory. The remaining child also prevents its replacement from
being registered on a subsequent bind.
Add a devres action immediately after registering the EDAC device.
This unregisters the child before the older regmap resources are
released, and also handles failure to allocate the action.
Fixes: c081f3060fab ("soc: qcom: Add support to register LLCC EDAC driver")
Cc: stable@vger.kernel.org
Signed-off-by: Yige Jiang <yigejiang86@gmail.com>
---
Based on Qualcomm for-next as merged in next-20261201.
Compile-tested on next-20261104: arm64, GCC 14.2.0, W=1;
baseline and patched objects built without warnings.
Both CONFIG_QCOM_LLCC=y and =m were checked.
The code changes are the same as in that build.
No hardware or runtime test was performed.
drivers/soc/qcom/llcc-qcom.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/qcom/llcc-qcom.c b/drivers/soc/qcom/llcc-qcom.c
index 166ad2e996f745c97655d4e92e4e034f8771f202..37baaeec55246b187ef498ff0fbbe4bc90434334 100644
--- a/drivers/soc/qcom/llcc-qcom.c
+++ b/drivers/soc/qcom/llcc-qcom.c
@@ -5749,6 +5749,11 @@ static struct regmap *qcom_llcc_init_mmio(struct platform_device *pdev, u8 index
return devm_regmap_init_mmio(&pdev->dev, base, &llcc_regmap_config);
}
+static void qcom_llcc_unregister_edac(void *data)
+{
+ platform_device_unregister(data);
+}
+
static int qcom_llcc_probe(struct platform_device *pdev)
{
u32 num_banks;
@@ -5889,8 +5894,14 @@ static int qcom_llcc_probe(struct platform_device *pdev)
llcc_edac = platform_device_register_data(&pdev->dev,
"qcom_llcc_edac", -1, drv_data,
sizeof(*drv_data));
- if (IS_ERR(llcc_edac))
+ if (IS_ERR(llcc_edac)) {
dev_err(dev, "Failed to register LLCC EDAC driver\n");
+ } else {
+ ret = devm_add_action_or_reset(dev, qcom_llcc_unregister_edac,
+ llcc_edac);
+ if (ret)
+ goto err;
+ }
}
platform_set_drvdata(pdev, drv_data);
base-commit: ef922b721a5e99348fc1f5801fdeb427ee14ee9f
reply other threads:[~2026-12-02 19:15 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=20261202233909.fe2f84b3eae2.llcc-edac@gmail.com \
--to=yigejiang86@gmail.com \
--cc=abelvesa@kernel.org \
--cc=andersson@kernel.org \
--cc=konradybcio@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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.