From: "Nuno Sá" <noname.nuno@gmail.com>
To: Guenter Roeck <linux@roeck-us.net>,
nuno.sa@analog.com, linux-hwmon@vger.kernel.org,
linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
linux-doc@vger.kernel.org
Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Jean Delvare <jdelvare@suse.com>,
Jonathan Corbet <corbet@lwn.net>,
Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
"Rob Herring (Arm)" <robh@kernel.org>,
Linus Walleij <linusw@kernel.org>,
Bartosz Golaszewski <brgl@kernel.org>
Subject: Re: [PATCH v5 0/3] hwmon: Add support for the LTC4283 Hot Swap Controller
Date: Wed, 28 Jan 2026 09:44:03 +0000 [thread overview]
Message-ID: <382e259ea3835ffbd2be9c36b529875f5a43f38b.camel@gmail.com> (raw)
In-Reply-To: <eed64bf1-93af-4b36-adf5-1476cb40edbb@roeck-us.net>
Hi Guenter,
On Tue, 2026-01-27 at 09:39 -0800, Guenter Roeck wrote:
> Hi Nuno,
>
> On 12/23/25 04:21, Nuno Sá via B4 Relay wrote:
> > This is v3 for the LTC4283 how swap controller. Main change is that I'm
> > now using the auxiliary bus for adding the GPIO device (done depending
> > on FW properties).
> >
> > Similar to the LTC4282 device, we're clearing some fault logs in the
> > reset_history attributes.
> >
>
> I ran the patch series through an AI review. Results are below.
> Please take a look.
>
> Thanks,
> Guenter
>
> ---
> # Deep Dive Regression Analysis Log
> Date: 2026-01-27
>
> ## Commit 5998c620fbd8: gpio: gpio-ltc4283: Add support for the LTC4283 Swap Controller
>
> **Context**:
> - Adds a new GPIO driver `drivers/gpio/gpio-ltc4283.c`.
> - Depends on `drivers/hwmon/ltc4283.c` for regmap and MFD instantiation.
>
> **Findings**:
> 1. **Typo/Naming Issue**:
> - File `drivers/gpio/gpio-ltc4283.c` uses `LTC42823_ADIO_CONFIG` definition.
> - `LTC42823` appears to be a typo for `LTC4283`.
> - `drivers/gpio/gpio-ltc4283.c:26`: `#define LTC42823_ADIO_CONFIG 0x12`
>
> 2. **Logic Verification**:
> - GPIO direction and value setting logic appears consistent with bitmasks provided, assuming
> register `0x12` and `0x11` layout is correct as inferred.
>
> 3. **Regressions**:
> - No critical functional regressions found in this commit alone.
> - Code quality: Typo in macro name.
>
> ## Commit 82433332ce16: hwmon: ltc4283: Add support for the LTC4283 Swap Controller
>
> **Context**:
> - Adds core HWMON driver `drivers/hwmon/ltc4283.c`.
> - Handles I2C communication, regmap initialization, and MFD child creation.
>
> **Findings**:
> 1. **Critical Regression: DebugFS Use-After-Free**:
> - `ltc4283_probe` calls `ltc4283_debugfs_init`.
> - `ltc4283_debugfs_init` calls `debugfs_create_file_unsafe` creating files associated with
> `st`.
> - `st` is allocated with `devm_kzalloc`.
> - **Issue**: There is no explicit cleanup of debugfs entries (e.g.,
> `debugfs_remove_recursive`) and no `devm_add_action` to handle it.
> - **Consequence**: When the driver is unbound/unloaded, `st` is freed by devm. The debugfs
> entries remain. Accessing them triggers a Use-After-Free on `st`.
> - **Fix Required**: Use `devm_add_action_or_reset` to remove debugfs directory/entries on
> driver detach.
So actually a nice deduction from the agent but not accurate given that all the entries should be
removed in [1]. If you want it to be explicit, I can add the action but given that the dentry is
given by i2c, I would argue it's fair to assume i2c will take care of the removal. Thoughts?
I'm also planning to pick this up again but was caught by something else. So hopefully next week.
On another topic, I also (you questioned it in another thread) looked around and I do have a ltc4282
board with me. Given that I just need to power up the digital parts to access the i2c bus, it should
be pretty straight to get a register dump. So if you're still interested on that, I should be able
to do it.
[1]: https://elixir.bootlin.com/linux/v6.19-rc5/source/drivers/i2c/i2c-core-base.c#L634
- Nuno Sá
>
next prev parent reply other threads:[~2026-01-28 9:43 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-23 12:21 [PATCH v5 0/3] hwmon: Add support for the LTC4283 Hot Swap Controller Nuno Sá via B4 Relay
2025-12-23 12:21 ` [PATCH v5 1/3] dt-bindings: hwmon: Document the LTC4283 " Nuno Sá via B4 Relay
2025-12-23 12:21 ` [PATCH v5 2/3] hwmon: ltc4283: Add support for " Nuno Sá via B4 Relay
2025-12-23 12:21 ` [PATCH v5 3/3] gpio: gpio-ltc4283: " Nuno Sá via B4 Relay
2026-01-18 0:27 ` [PATCH v5 0/3] hwmon: Add support for the LTC4283 Hot " Guenter Roeck
2026-01-18 10:12 ` Nuno Sá
2026-01-18 15:39 ` Guenter Roeck
2026-02-17 13:39 ` Nuno Sá
2026-02-21 1:17 ` Guenter Roeck
2026-01-27 17:39 ` Guenter Roeck
2026-01-28 9:44 ` Nuno Sá [this message]
2026-01-28 10:04 ` Guenter Roeck
2026-01-28 16:55 ` Guenter Roeck
2026-01-28 18:07 ` Nuno Sá
2026-01-28 18:22 ` Guenter Roeck
2026-02-02 9:40 ` Nuno Sá
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=382e259ea3835ffbd2be9c36b529875f5a43f38b.camel@gmail.com \
--to=noname.nuno@gmail.com \
--cc=brgl@bgdev.pl \
--cc=brgl@kernel.org \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=jdelvare@suse.com \
--cc=krzk+dt@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linusw@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.org \
/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