Linux-i3c Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Lakshay Piplani" <lakshay.piplani@nxp.com>,
	linux-i3c@lists.infradead.org, mfd@lists.linux.dev
Cc: Frank.Li@kernel.org,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	lee@kernel.org
Subject: Re: [PATCH v23 4/5] i3c: hub: p3h2x4x: Add support for NXP P3H2x4x I3C hub functionality
Date: Sun, 29 Nov 2026 09:15:33 +0000	[thread overview]
Message-ID: <sashiko-outbox-239440@kernel.org> (raw)
In-Reply-To: <20261129090506.101213-5-lakshay.piplani@nxp.com>

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@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

-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

  reply	other threads:[~2026-11-29  9:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29  9:05 [PATCH v23 0/5] Add support for NXP P3H2x4x I3C hub driver Lakshay Piplani
2026-11-29  9:05 ` [PATCH v23 1/5] i3c: hub: Fix downstream address reservations on parent bus Lakshay Piplani
2026-11-29  9:27   ` sashiko-bot
2026-12-01 21:05     ` Frank Li
2026-11-29  9:05 ` [PATCH v23 2/5] mfd: p3h2x4x: Add driver for NXP P3H2x4x i3c hub and on-die regulator Lakshay Piplani
2026-11-29  9:05 ` [PATCH v23 3/5] regulator: p3h2x4x: Add driver for on-die regulators in NXP P3H2x4x i3c hub Lakshay Piplani
2026-11-29  9:05 ` [PATCH v23 4/5] i3c: hub: p3h2x4x: Add support for NXP P3H2x4x I3C hub functionality Lakshay Piplani
2026-11-29  9:15   ` sashiko-bot [this message]
2026-12-01 21:08     ` Frank Li
2026-11-29  9:05 ` [PATCH v23 5/5] i3c: hub: p3h2x4x: Add SMBus slave mode support Lakshay Piplani

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-239440@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=lakshay.piplani@nxp.com \
    --cc=lee@kernel.org \
    --cc=linux-i3c@lists.infradead.org \
    --cc=mfd@lists.linux.dev \
    --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