From: sashiko-bot@kernel.org
To: "Adrian Hunter" <adrian.hunter@intel.com>
Cc: Frank.Li@kernel.org,
"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
linux-i3c@lists.infradead.org
Subject: Re: [PATCH RFC 5/7] i3c: mipi-i3c-hci-pci: Propagate I3C wakeup requirements to PCI
Date: Wed, 01 Jul 2026 20:26:40 +0000 [thread overview]
Message-ID: <20260701202640.D89671F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260701200552.220042-6-adrian.hunter@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Dereference of unvalidated `drvdata` in suspend path leads to NULL pointer crash if child driver is unbound.
--
commit 1a652f2d9252aa55258e44d095e09f412a966337
Author: Adrian Hunter <adrian.hunter@intel.com>
i3c: mipi-i3c-hci-pci: Propagate I3C wakeup requirements to PCI
Keep the PCI wakeup state aligned with the wakeup requirements of the devices
served by the controller(s). It checks whether any HCI instance has a
wakeup-enabled I3C device and enables wakeup for the PCI function.
> diff --git a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
> index 5a9e2a43eff8d..2b3bf6fa74f29 100644
> --- a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
> +++ b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
[ ... ]
> @@ -272,6 +274,13 @@ static bool mipi_i3c_hci_pci_is_mfd(struct device *dev)
> return dev_is_platform(dev) && mfd_get_cell(to_platform_device(dev));
> }
>
> +static bool mipi_i3c_hci_pci_any_wakeup_enabled(struct device *dev)
> +{
> + struct i3c_hci *hci = dev_get_drvdata(dev);
> +
> + return i3c_master_any_wakeup_enabled(&hci->master);
> +}
> +
[Severity: High]
This is a pre-existing issue, but does this code lead to a NULL pointer
dereference if the child driver is unbound?
If a privileged user unbinds the mipi_i3c_hci driver from a child platform
device via sysfs, drvdata is cleared to NULL.
Because the driver's remove callback does not disable the hardware controller
or clear the HC_CONTROL_BUS_ENABLE register bit,
mipi_i3c_hci_pci_is_operational() can still return true for this device
during a subsequent system suspend.
The PCI suspend instance iterator then passes the potentially unbound device
into this new function, which fetches the NULL drvdata and blindly
dereferences it.
The pre-existing i3c_hci_rpm_suspend() function called earlier in the same
suspend path appears to suffer from the exact same problem:
core.c:i3c_hci_rpm_suspend() {
struct i3c_hci *hci = dev_get_drvdata(dev);
/* Fall back to software reset to disable the bus */
if (i3c_hci_bus_disable(hci))
...
}
Should the suspend path validate that drvdata is non-NULL or that the driver
is actually bound before proceeding with these suspend operations?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260701200552.220042-1-adrian.hunter@intel.com?part=5
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
next prev parent reply other threads:[~2026-07-01 20:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 20:05 [PATCH RFC 0/7] i3c: Support IBI-based system wakeup Adrian Hunter
2026-07-01 20:05 ` [PATCH RFC 1/7] i3c: master: Support IBI-based wakeup capability Adrian Hunter
2026-07-01 20:26 ` sashiko-bot
2026-07-01 20:05 ` [PATCH RFC 2/7] i3c: master: Report wakeup events for IBIs Adrian Hunter
2026-07-01 20:27 ` sashiko-bot
2026-07-01 20:05 ` [PATCH RFC 3/7] i3c: master: Add helper to query bus wakeup requirements Adrian Hunter
2026-07-01 20:23 ` sashiko-bot
2026-07-01 20:05 ` [PATCH RFC 4/7] i3c: master: Reject IBI requests from non-IBI-capable devices Adrian Hunter
2026-07-01 20:05 ` [PATCH RFC 5/7] i3c: mipi-i3c-hci-pci: Propagate I3C wakeup requirements to PCI Adrian Hunter
2026-07-01 20:26 ` sashiko-bot [this message]
2026-07-01 20:05 ` [PATCH RFC 6/7] i3c: mipi-i3c-hci: Factor out i3c_hci_sysdev() Adrian Hunter
2026-07-01 20:05 ` [PATCH RFC 7/7] i3c: mipi-i3c-hci: Advertise IBI wakeup capability Adrian Hunter
2026-07-01 20:15 ` [PATCH RFC 0/7] i3c: Support IBI-based system wakeup Adrian Hunter
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=20260701202640.D89671F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexandre.belloni@bootlin.com \
--cc=linux-i3c@lists.infradead.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