[PATCH v23 4/5] i3c: hub: p3h2x4x: Add support for NXP P3H2x4x I3C hub functionality
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Sun Nov 29 01:15:33 PST 2026
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] i3c: hub: NULL cur_master dereference via sysfs after
p3h2x4x_tp_i3c_algo()
--
commit 9821222e48afd6bb8dc8fb08586bcdb11b5cbe63
Author: Aman Kumar Pandey <aman.kumarpandey at nxp.com>
i3c: hub: p3h2x4x: Add support for NXP P3H2x4x I3C hub functionality
This commit adds the I3C hub driver for the NXP P3H2x4x multiport hub
family, registering virtual I3C controllers and I2C/SMBus adapters for
downstream target ports.
> diff --git a/drivers/i3c/hub/p3h2840_i3c_hub_i3c.c b/drivers/i3c/hub/p3h2840_i3c_hub_i3c.c
> new file mode 100644
> index 0000000000000..ef93c577a68ca
> --- /dev/null
> +++ b/drivers/i3c/hub/p3h2840_i3c_hub_i3c.c
[ ... ]
> +int p3h2x4x_tp_i3c_algo(struct p3h2x4x_i3c_hub_dev *p3h2x4x_hub)
> +{
[ ... ]
> + /*
> + * The routing lock must be released here: registration runs
> + * CCCs and DAA through the hub callbacks, which take it again.
> + */
> + ret = i3c_master_register_fwnode(controller,
> + p3h2x4x_hub->dev,
> + of_fwnode_handle(p3h2x4x_hub->tp_bus[tp].of_node),
> + &i3c_hub_master_ops,
> + false);
[Severity: High]
Does registering the virtual controller with i3c_hub_master_ops leave
controller->bus.cur_master NULL and allow a NULL pointer dereference via
sysfs?
Physical I3C controller drivers call i3c_master_set_info(), which sets
both master->this and master->bus.cur_master, whereas
i3c_hub_master_bus_init() only assigns controller->this:
drivers/i3c/hub.c:i3c_hub_master_bus_init() {
...
controller->this = hub->hub_dev->desc;
return 0;
}
When userspace reads the current_master or hotjoin sysfs attribute on the
registered virtual bus, current_master_show() and hotjoin_show()
dereference i3cbus->cur_master without checking for NULL.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261129090506.101213-1-lakshay.piplani@nxp.com?part=4
More information about the linux-i3c
mailing list