[PATCH v2] i3c: master: Fix fwnode reference leak in i3c_master_register_fwnode()
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Sun Nov 8 01:41:28 PST 2026
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] i3c: master: wrong Fixes trailer in commit message for
i3c_master_rpm_get()
--
commit ba01aeefaeda899682ea26dfc02330d61d63300a
Author: Wentao Liang <vulab at iscas.ac.cn>
> i3c: master: Fix fwnode reference leak in i3c_master_register_fwnode()
>
> i3c_master_register_fwnode() takes a reference on the bus firmware node
> with fwnode_handle_get() and stores it in master->dev. That reference is
> normally dropped by i3c_masterdev_release(), which runs when the last
> reference on the master device is put.
>
> If i3c_master_rpm_get() fails, the function returns before
> device_initialize(), so put_device() is never called, the release
> callback never runs, and the reference is leaked.
>
> Release the reference explicitly on that path. of_node_put() is not
> enough here: it only acts on Open Firmware nodes, so the reference would
> still leak on ACPI and software node systems.
>
> The candidate was found with static analysis tools; DeepSeek and GPT-6.1
> Sol were used to audit it and to help prepare this fix.
>
> Fixes: 3a379bbcea0a ("i3c: Add core I3C infrastructure")
> Signed-off-by: Wentao Liang <vulab at iscas.ac.cn>
[Severity: Low]
Should the Fixes: tag reference 990c149c61ee ("i3c: master: Introduce
optional Runtime PM support") instead?
The original error return before device_initialize() in 3a379bbcea0a
("i3c: Add core I3C infrastructure") was fixed by 9d4f219807d5 ("i3c: fix
refcount inconsistency in i3c_master_register"), while 990c149c61ee
("i3c: master: Introduce optional Runtime PM support") added the
i3c_master_rpm_get() call before device_initialize().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261108092920.314161-1-vulab@iscas.ac.cn?part=1
More information about the linux-i3c
mailing list