mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/2] net: pse-pd: si3474: probe error path cleanups
@ 2026-10-20 17:11 Carlo Szelinsky
  2026-10-20 17:11 ` [PATCH net-next v2 1/2] net: pse-pd: si3474: fix use-after-free in ancillary client error path Carlo Szelinsky
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Carlo Szelinsky @ 2026-10-20 17:11 UTC (permalink / raw)
  To: Oleksij Rempel, Kory Maincent, Andrew Lunn, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Piotr Kubik, Sai Krishna, Simon Horman, Kyle Swenson,
	netdev-bot+sashiko, netdev, linux-kernel, Carlo Szelinsky

Two small changes to the error paths in si3474 probe. They do not
depend on the PSE fixes for net ("net: pse-pd: assorted lifetime and
error-path fixes" v2) and apply to net-next as they are.

 1  The error message after a failed devm_add_action_or_reset() reads
    the ancillary I2C client, which was just unregistered.
 2  Use dev_err_probe() for a failed controller registration, as
    pd692x0 and tps23881 do.

1 was found by code inspection and not reproduced. Both are
build-tested only, with W=1.

Changes in v2:
 - 1 was patch 9 of the net series v1 [1]. Kory asked to send it to
   net-next, as it is not an urgent fix. Collected his Reviewed-by.
 - 2 was patch 3 of the net-next series v1 [2]. Its message no longer
   mentions the vpwr supply check from that series, which is not part
   of this version.

[1] https://lore.kernel.org/netdev/20261018082314.48950-1-github@szelinsky.de/
[2] https://lore.kernel.org/netdev/20261018081853.47484-1-github@szelinsky.de/

Carlo Szelinsky (2):
  net: pse-pd: si3474: fix use-after-free in ancillary client error path
  net: pse-pd: si3474: use dev_err_probe() for controller registration

 drivers/net/pse-pd/si3474.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)


base-commit: 8cc24527d54d3ecaa09eec5a91bd107bb8b3d7d3
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next v2 1/2] net: pse-pd: si3474: fix use-after-free in ancillary client error path
  2026-10-20 17:11 [PATCH net-next v2 0/2] net: pse-pd: si3474: probe error path cleanups Carlo Szelinsky
@ 2026-10-20 17:11 ` Carlo Szelinsky
  2026-10-20 17:11 ` [PATCH net-next v2 2/2] net: pse-pd: si3474: use dev_err_probe() for controller registration Carlo Szelinsky
  2026-10-20 17:15 ` [PATCH net-next v2 0/2] net: pse-pd: si3474: probe error path cleanups Kory Maincent
  2 siblings, 0 replies; 4+ messages in thread
From: Carlo Szelinsky @ 2026-10-20 17:11 UTC (permalink / raw)
  To: Oleksij Rempel, Kory Maincent, Andrew Lunn, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Piotr Kubik, Sai Krishna, Simon Horman, Kyle Swenson,
	netdev-bot+sashiko, netdev, linux-kernel, Carlo Szelinsky

If devm_add_action_or_reset() fails, it has already unregistered the
ancillary I2C client, and the error message then reads that client's
device. It can only fail with -ENOMEM, which is already reported, so
drop the message.

Found by code inspection. Not reproduced.

Fixes: a2317231df4b ("net: pse-pd: Add Si3474 PSE controller driver")
Reviewed-by: Kory Maincent <kory.maincent@bootlin.com>
Signed-off-by: Carlo Szelinsky <github@szelinsky.de>
---
 drivers/net/pse-pd/si3474.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/pse-pd/si3474.c b/drivers/net/pse-pd/si3474.c
index 1845b9c51cf7..2f4f241a48af 100644
--- a/drivers/net/pse-pd/si3474.c
+++ b/drivers/net/pse-pd/si3474.c
@@ -516,10 +516,8 @@ static int si3474_i2c_probe(struct i2c_client *client)
 		return PTR_ERR(priv->client[1]);
 
 	ret = devm_add_action_or_reset(dev, si3474_ancillary_i2c_remove, priv->client[1]);
-	if (ret < 0) {
-		dev_err(&priv->client[1]->dev, "Cannot register remove callback\n");
+	if (ret)
 		return ret;
-	}
 
 	ret = i2c_smbus_read_byte_data(priv->client[1], VENDOR_IC_ID_REG);
 	if (ret < 0) {
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next v2 2/2] net: pse-pd: si3474: use dev_err_probe() for controller registration
  2026-10-20 17:11 [PATCH net-next v2 0/2] net: pse-pd: si3474: probe error path cleanups Carlo Szelinsky
  2026-10-20 17:11 ` [PATCH net-next v2 1/2] net: pse-pd: si3474: fix use-after-free in ancillary client error path Carlo Szelinsky
@ 2026-10-20 17:11 ` Carlo Szelinsky
  2026-10-20 17:15 ` [PATCH net-next v2 0/2] net: pse-pd: si3474: probe error path cleanups Kory Maincent
  2 siblings, 0 replies; 4+ messages in thread
From: Carlo Szelinsky @ 2026-10-20 17:11 UTC (permalink / raw)
  To: Oleksij Rempel, Kory Maincent, Andrew Lunn, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Piotr Kubik, Sai Krishna, Simon Horman, Kyle Swenson,
	netdev-bot+sashiko, netdev, linux-kernel, Carlo Szelinsky

si3474 prints the error of a failed controller registration as a hex
number, such as 0xfffffff4 for -ENOMEM. Use dev_err_probe(), as
pd692x0 and tps23881 already do. It prints the error by name, and if
the registration ever returns -EPROBE_DEFER, it does not log that as
an error.

Only the log message changes.

Signed-off-by: Carlo Szelinsky <github@szelinsky.de>
---
 drivers/net/pse-pd/si3474.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/pse-pd/si3474.c b/drivers/net/pse-pd/si3474.c
index 2f4f241a48af..efb0af041599 100644
--- a/drivers/net/pse-pd/si3474.c
+++ b/drivers/net/pse-pd/si3474.c
@@ -539,10 +539,9 @@ static int si3474_i2c_probe(struct i2c_client *client)
 	priv->pcdev.nr_lines = SI3474_MAX_CHANS;
 
 	ret = devm_pse_controller_register(dev, &priv->pcdev);
-	if (ret) {
-		dev_err(dev, "Failed to register PSE controller: 0x%x\n", ret);
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret,
+				     "Failed to register PSE controller\n");
 
 	return 0;
 }
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next v2 0/2] net: pse-pd: si3474: probe error path cleanups
  2026-10-20 17:11 [PATCH net-next v2 0/2] net: pse-pd: si3474: probe error path cleanups Carlo Szelinsky
  2026-10-20 17:11 ` [PATCH net-next v2 1/2] net: pse-pd: si3474: fix use-after-free in ancillary client error path Carlo Szelinsky
  2026-10-20 17:11 ` [PATCH net-next v2 2/2] net: pse-pd: si3474: use dev_err_probe() for controller registration Carlo Szelinsky
@ 2026-10-20 17:15 ` Kory Maincent
  2 siblings, 0 replies; 4+ messages in thread
From: Kory Maincent @ 2026-10-20 17:15 UTC (permalink / raw)
  To: Carlo Szelinsky, Oleksij Rempel, Andrew Lunn, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Piotr Kubik, Sai Krishna, Simon Horman, Kyle Swenson,
	netdev-bot+sashiko, netdev, linux-kernel



On 10/20/26 19:11, Carlo Szelinsky wrote:
> Two small changes to the error paths in si3474 probe. They do not
> depend on the PSE fixes for net ("net: pse-pd: assorted lifetime and
> error-path fixes" v2) and apply to net-next as they are.
> 
>   1  The error message after a failed devm_add_action_or_reset() reads
>      the ancillary I2C client, which was just unregistered.
>   2  Use dev_err_probe() for a failed controller registration, as
>      pd692x0 and tps23881 do.
> 
> 1 was found by code inspection and not reproduced. Both are
> build-tested only, with W=1.

Hello,
net-next is currently close as we are in the merge window.
Please resend it when it open again:
https://netdev.bots.linux.dev/net-next.html

-- 
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-20 17:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-20 17:11 [PATCH net-next v2 0/2] net: pse-pd: si3474: probe error path cleanups Carlo Szelinsky
2026-10-20 17:11 ` [PATCH net-next v2 1/2] net: pse-pd: si3474: fix use-after-free in ancillary client error path Carlo Szelinsky
2026-10-20 17:11 ` [PATCH net-next v2 2/2] net: pse-pd: si3474: use dev_err_probe() for controller registration Carlo Szelinsky
2026-10-20 17:15 ` [PATCH net-next v2 0/2] net: pse-pd: si3474: probe error path cleanups Kory Maincent

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®