All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Dhaval Shiroya" <dhaval.shiroya@siliconsignals.io>
Cc: linux-rtc@vger.kernel.org,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>
Subject: Re: [PATCH] rtc: rv3028: configure backup switch mode from device tree
Date: Sat, 22 Aug 2026 09:39:14 +0000	[thread overview]
Message-ID: <20260822093914.95CD41F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260822092911.318342-1-dhaval.shiroya@siliconsignals.io>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:

New issues:
- [Critical] Removal of the `RTC_PARAM_BACKUP_SWITCH_MODE` userspace parameter breaks the userspace ABI.
- [Medium] Introduction of an undocumented, un-prefixed, and hardware-specific DT property `backup-switch-mode`.

Pre-existing issues:
- [High] The clock provider registered during probe is never removed, leaving a dangling pointer in the OF clock provider list when the driver is unbound.
--

--- Patch [1]: [PATCH] rtc: rv3028: configure backup switch mode from device tree ---
commit 55d9a6511b8e26eb9e90d9e9a4a3d1d04b2c0f1b
Author: Dhaval Shiroya <dhaval.shiroya@siliconsignals.io>

rtc: rv3028: configure backup switch mode from device tree
    
Enable and set the backup switch mode directly from the device tree at
probe, instead of requiring a userspace RTC_PARAM_BACKUP_SWITCH_MODE
ioctl on every unit.

> diff --git a/drivers/rtc/rtc-rv3028.c b/drivers/rtc/rtc-rv3028.c
> index d96f6bb68850d..5dde1aed76dd7 100644
> --- a/drivers/rtc/rtc-rv3028.c
> +++ b/drivers/rtc/rtc-rv3028.c
[ ... ]
> @@ -852,8 +789,6 @@ static const struct rtc_class_ops rv3028_rtc_ops = {
>  	.read_offset = rv3028_read_offset,
>  	.set_offset = rv3028_set_offset,
>  	.ioctl = rv3028_ioctl,
> -	.param_get = rv3028_param_get,
> -	.param_set = rv3028_param_set,
>  };

[Severity: Critical]
Does removing the param_get and param_set callbacks break existing userspace
ABI?

Existing applications or scripts (like hwclock) that rely on querying or
modifying the backup switchover mode via the RTC_PARAM_GET and RTC_PARAM_SET
ioctls will encounter failures, as the API has been entirely removed from the
driver.

[ ... ]
> @@ -920,6 +855,65 @@ static u8 rv3028_set_trickle_charger(struct rv3028_data *rv3028,
[ ... ]
> +static int rv3028_set_bsm_from_dt(struct rv3028_data *rv3028,
> +				  struct i2c_client *client)
> +{
> +	u32 val_old, bsm_dt, bsm_bits;
> +	int ret;
> +
> +	if (device_property_read_u32(&client->dev, "backup-switch-mode",
> +				     &bsm_dt))
> +		return 0;

[Severity: Medium]
Is this new device tree property documented in the binding schema?

Adding an undocumented, un-prefixed property that requires raw
hardware-specific bit values (0, 1, or 3) instead of a standard
vendor-prefixed property (e.g., "microcrystal,backup-switch-mode") will
trigger warnings during dtbs_check. 

The device tree schema likely enforces unevaluatedProperties: false, which
will flag this missing schema definition as an invalid configuration.

[ ... ]
> @@ -1005,11 +999,14 @@ static int rv3028_probe(struct i2c_client *client)
[ ... ]
> -	set_bit(RTC_FEATURE_BACKUP_SWITCH_MODE, rv3028->rtc->features);

[Severity: Critical]
Does removing this capability flag cause the kernel to reject userspace
attempts to configure the parameter?

This reinforces the ABI break mentioned above, preventing any userspace
process with access to the RTC device node from interacting with the backup
switchover mode.


While reviewing this patch, I noticed a pre-existing issue in the surrounding
clock registration code:

drivers/rtc/rtc-rv3028.c:rv3028_clkout_register_clk() {
    ...
    of_clk_add_provider(node, of_clk_src_simple_get, clk);
    ...
}

[Severity: High]
This is a pre-existing issue, but does this leave a dangling pointer in the
OF clock provider list when the driver is unbound?

The clock object is allocated and registered using devm_clk_register(), meaning
devres automatically frees the clk structure when the device is unbound.
However, of_clk_add_provider() is a non-managed API that registers the clock
provider globally. 

Because this driver lacks a .remove callback to unregister the provider, a
subsequent clock lookup after unbind could attempt to use the freed structure,
leading to a use-after-free.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260822092911.318342-1-dhaval.shiroya@siliconsignals.io?part=1

  reply	other threads:[~2026-08-22  9:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-22  9:29 [PATCH] rtc: rv3028: configure backup switch mode from device tree Dhaval Shiroya
2026-08-22  9:39 ` sashiko-bot [this message]
2026-08-22 13:09 ` Alexandre Belloni
2026-08-26  6:37   ` Dhaval Shiroya
2026-08-26  6:57     ` Alexandre Belloni
2026-08-24 23:05 ` kernel test robot
2026-08-25  1:34 ` kernel test robot

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=20260822093914.95CD41F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=dhaval.shiroya@siliconsignals.io \
    --cc=linux-rtc@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.