From: sashiko-bot@kernel.org
To: "Fenglin Wu" <fenglin.wu@oss.qualcomm.com>
Cc: linux-rtc@vger.kernel.org,
"Alexandre Belloni" <alexandre.belloni@bootlin.com>
Subject: Re: [PATCH 3/3] rtc: Add Qualcomm GIO RTC driver
Date: Wed, 11 Nov 2026 04:20:58 +0000 [thread overview]
Message-ID: <sashiko-outbox-208272@kernel.org> (raw)
In-Reply-To: <20261110-gio-framework-rtc-driver-2026-10-12-v1-3-e4164178183a@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] soc: qcom: devm-allocated auxiliary_device in
pmic_glink_gio_add_consumer()
--
commit d5c1d09a8c9a83fd69f16467e16b3f0ae413a0cd
Author: Fenglin Wu <fenglin.wu@oss.qualcomm.com>
rtc: Add Qualcomm GIO RTC driver
This commit adds an auxiliary RTC driver for the Qualcomm GIO interface
and registers the "pmic_gio.rtc" auxiliary device from the PMIC GLINK GIO
driver.
> diff --git a/drivers/soc/qcom/pmic_glink_gio.c b/drivers/soc/qcom/pmic_glink_gio.c
> index f222c0d59220f..83656a5758b81 100644
> --- a/drivers/soc/qcom/pmic_glink_gio.c
> +++ b/drivers/soc/qcom/pmic_glink_gio.c
[ ... ]
> @@ -318,6 +320,28 @@ static void pmic_glink_gio_enable_alerts(struct pmic_glink_gio *pgio)
> dev_err(pgio->dev, "GIO turn on global alert failed: %d\n", ret);
> }
>
> +static int pmic_glink_gio_add_consumer(struct pmic_glink_gio *pgio,
> + struct auxiliary_device **aux,
> + const char *name)
> +{
> + struct auxiliary_device *new_aux;
> + int ret;
> +
> + new_aux = devm_kzalloc(pgio->dev, sizeof(*new_aux), GFP_KERNEL);
> + if (!new_aux)
> + return -ENOMEM;
> +
> + ret = devm_pmic_gio_add_consumer(pgio->gio, new_aux, name);
> + if (ret) {
> + devm_kfree(pgio->dev, new_aux);
> + return ret;
> + }
[Severity: Medium]
Can allocating new_aux with devm_kzalloc() cause a use-after-free when
pgio->dev unbinds or when devm_pmic_gio_add_consumer() fails after
auxiliary_device_init()?
devm_pmic_gio_add_consumer() initializes new_aux->dev with
auxiliary_device_init():
drivers/soc/qcom/pmic_gio.c:devm_pmic_gio_add_consumer() {
...
aux->dev.release = pmic_gio_aux_release;
aux->dev.platform_data = gio;
device_set_of_node_from_dev(&aux->dev, gio->dev);
ret = auxiliary_device_init(aux);
...
ret = auxiliary_device_add(aux);
if (ret) {
auxiliary_device_uninit(aux);
return ret;
}
return devm_add_action_or_reset(gio->dev, pmic_gio_del_aux_device, aux);
}
Once auxiliary_device_init() has been called, the lifetime of new_aux is
governed by the embedded struct device reference count and its memory may
only be freed from the dev.release callback. Instead, devres frees
new_aux as soon as pgio->dev unbinds (or immediately via devm_kfree() if
auxiliary_device_add() fails), while references to new_aux->dev are still
held or before delayed kobject release runs.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261110-gio-framework-rtc-driver-2026-10-12-v1-0-e4164178183a@oss.qualcomm.com?part=3
prev parent reply other threads:[~2026-11-11 4:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 3:28 [PATCH 0/3] soc: qcom: Add Qualcomm PMIC GIO framework and RTC driver using it Fenglin Wu
2026-11-11 3:28 ` [PATCH 1/3] soc: qcom: Add pmic-gio GIO framework driver Fenglin Wu
2026-11-11 3:47 ` sashiko-bot
2026-11-11 3:28 ` [PATCH 2/3] soc: qcom: pmic_glink: Add GIO pmic_glink instance Fenglin Wu
2026-11-11 4:07 ` sashiko-bot
2026-11-11 13:14 ` Jeff Roach
2026-11-11 13:41 ` Jeff Roach
2026-11-12 1:11 ` Fenglin Wu
2026-11-12 7:10 ` Fenglin Wu
2026-11-11 3:28 ` [PATCH 3/3] rtc: Add Qualcomm GIO RTC driver Fenglin Wu
2026-11-11 4:20 ` sashiko-bot [this message]
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-208272@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alexandre.belloni@bootlin.com \
--cc=fenglin.wu@oss.qualcomm.com \
--cc=linux-rtc@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox