Re: [PATCH 03/17] i3c: mipi-i3c-hci-pci: Set drvdata before creating LTR sysfs attribute
From: Frank Li
Date: Mon Sep 14 2026 - 13:23:33 EST
On Mon, Sep 14, 2026 at 02:29:49PM +0300, Adrian Hunter wrote:
> intel_i3c_init() creates the pm_qos_latency_tolerance_us sysfs attribute
> before probe calls pci_set_drvdata(). A userspace write to the attribute
> can therefore invoke intel_ltr_set(), which uses pci_get_drvdata(),
> before drvdata has been initialized.
>
> Move pci_set_drvdata() before hci->info->init() so drvdata is available
> before the sysfs attribute becomes accessible.
>
> Fixes: 884a33131f2a ("i3c: mipi-i3c-hci-pci: Add LTR support for Intel controllers")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>
> ---
Reviewed-by: Frank Li <Frank.Li@xxxxxxx>
> drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> 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 ab595661db1e..af9595009b03 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
> @@ -445,6 +445,8 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
> if (ret < 0)
> return ret;
>
> + pci_set_drvdata(pci, hci);
> +
> hci->info = (const struct mipi_i3c_hci_pci_info *)id->driver_data;
>
> ret = hci->info->init ? hci->info->init(hci) : 0;
> @@ -455,8 +457,6 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
> if (ret)
> goto err_exit;
>
> - pci_set_drvdata(pci, hci);
> -
> mipi_i3c_hci_pci_rpm_allow(&pci->dev);
>
> return 0;
> --
> 2.53.0
>