lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ae2701a5-8662-47d3-81fa-30e832600423@sirena.org.uk>
Date: Thu, 2 Oct 2025 17:29:19 +0100
From: Mark Brown <broonie@...nel.org>
To: Tommaso Merciai <tommaso.merciai.xr@...renesas.com>
Cc: tomm.merciai@...il.com, linux-renesas-soc@...r.kernel.org,
	biju.das.jz@...renesas.com,
	Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>,
	Vinod Koul <vkoul@...nel.org>,
	Kishon Vijay Abraham I <kishon@...nel.org>,
	Geert Uytterhoeven <geert+renesas@...der.be>,
	Magnus Damm <magnus.damm@...il.com>,
	Liam Girdwood <lgirdwood@...il.com>, linux-phy@...ts.infradead.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 07/18] regulator: devres: Disable exclusive regulator
 before releasing

On Wed, Oct 01, 2025 at 11:26:51PM +0200, Tommaso Merciai wrote:

You've not copied me on the rest of the series so I don't know what's
going on with dependencies.  When sending a patch series it is important
to ensure that all the various maintainers understand what the
relationship between the patches as the expecation is that there will be
interdependencies.  Either copy everyone on the whole series or at least
copy them on the cover letter and explain what's going on.  If there are
no strong interdependencies then it's generally simplest to just send
the patches separately to avoid any possible confusion.

> Ensure that exclusive regulators are properly disabled when their reference
> count drops to one before they are released. This prevents possible issues
> where exclusive regulators may remain enabled unintentionally after being
> put.

The reason we don't normally drop references that devices hold is that
we're allowing the driver to control if the suppy should be disabled on
exit, powering off something that's critical for the system just because
we're not managing it in software won't go well.  Consider reloading a
module during development for example.

>  static void devm_regulator_release(struct device *dev, void *res)
>  {
> -	regulator_put(*(struct regulator **)res);
> +	struct regulator *regulator = *(struct regulator **)res;
> +	struct regulator_dev *rdev = regulator->rdev;
> +
> +	if (rdev->exclusive && regulator->enable_count == 1)
> +		regulator_disable(regulator);
> +
> +	regulator_put(regulator);
>  }

There's no reason that exclusive consumers don't use the refcounting
support...

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ