public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 5.10 054/147] regulator: core: Use ktime_get_boottime() to determine how long a regulator was off
       [not found] <20260228181736.1605592-1-sashal@kernel.org>
@ 2026-02-28 18:16 ` Sasha Levin
       [not found] ` <20260228181736.1605592-5-sashal@kernel.org>
       [not found] ` <20260228181736.1605592-22-sashal@kernel.org>
  2 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2026-02-28 18:16 UTC (permalink / raw)
  To: patches; +Cc: Matthias Kaehlcke, stable, Stephen Boyd, Mark Brown, Sasha Levin

From: Matthias Kaehlcke <mka@chromium.org>

[ Upstream commit 80d2c29e09e663761c2778167a625b25ffe01b6f ]

For regulators with 'off-on-delay-us' the regulator framework currently
uses ktime_get() to determine how long the regulator has been off
before re-enabling it (after a delay if needed). A problem with using
ktime_get() is that it doesn't account for the time the system is
suspended. As a result a regulator with a longer 'off-on-delay' (e.g.
500ms) that was switched off during suspend might still incurr in a
delay on resume before it is re-enabled, even though the regulator
might have been off for hours. ktime_get_boottime() accounts for
suspend time, use it instead of ktime_get().

Fixes: a8ce7bd89689 ("regulator: core: Fix off_on_delay handling")
Cc: stable@vger.kernel.org    # 5.13+
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20230223003301.v2.1.I9719661b8eb0a73b8c416f9c26cf5bd8c0563f99@changeid
Signed-off-by: Mark Brown <broonie@kernel.org>
Stable-dep-of: 86a8eeb0e913 ("regulator: core: move supply check earlier in set_machine_constraints()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/regulator/core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 84578a107fef2..6d413f936e0f2 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1510,7 +1510,7 @@ static int set_machine_constraints(struct regulator_dev *rdev)
 	}
 
 	if (rdev->desc->off_on_delay)
-		rdev->last_off = ktime_get();
+		rdev->last_off = ktime_get_boottime();
 
 	/* If the constraints say the regulator should be on at this point
 	 * and we have control then make sure it is enabled.
@@ -2628,7 +2628,7 @@ static int _regulator_do_enable(struct regulator_dev *rdev)
 		 * this regulator was disabled.
 		 */
 		ktime_t end = ktime_add_us(rdev->last_off, rdev->desc->off_on_delay);
-		s64 remaining = ktime_us_delta(end, ktime_get());
+		s64 remaining = ktime_us_delta(end, ktime_get_boottime());
 
 		if (remaining > 0)
 			_regulator_enable_delay(remaining);
@@ -2864,7 +2864,7 @@ static int _regulator_do_disable(struct regulator_dev *rdev)
 	}
 
 	if (rdev->desc->off_on_delay)
-		rdev->last_off = ktime_get();
+		rdev->last_off = ktime_get_boottime();
 
 	trace_regulator_disable_complete(rdev_get_name(rdev));
 
-- 
2.51.0


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

* Re: [PATCH 5.10 005/147] i3c: remove i2c board info from i2c_dev_desc
       [not found] ` <20260228181736.1605592-5-sashal@kernel.org>
@ 2026-03-17 13:13   ` Ben Hutchings
  0 siblings, 0 replies; 3+ messages in thread
From: Ben Hutchings @ 2026-03-17 13:13 UTC (permalink / raw)
  To: Sasha Levin, patches; +Cc: Jamie Iles, Alexandre Belloni, stable

[-- Attachment #1: Type: text/plain, Size: 666 bytes --]

On Sat, 2026-02-28 at 13:15 -0500, Sasha Levin wrote:
> From: Jamie Iles <quic_jiles@quicinc.com>
> 
> [ Upstream commit 31b9887c7258ca47d9c665a80f19f006c86756b1 ]
> 
> I2C board info is only required during adapter setup so there is no
> requirement to keeping a pointer to it once running.  To support dynamic
> device addition we can't rely on board info - user-space creation
> through sysfs won't have a boardinfo.
[...]

This was broken and needs commit 6cbf8b38dfe3 "i3c: fix uninitialized
variable use in i2c setup" as a follow-up.

Ben.


-- 
Ben Hutchings
For every complex problem
there is a solution that is simple, neat, and wrong.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 5.10 022/147] s390/cio: Fix device lifecycle handling in css_alloc_subchannel()
       [not found] ` <20260228181736.1605592-22-sashal@kernel.org>
@ 2026-03-17 14:16   ` Ben Hutchings
  0 siblings, 0 replies; 3+ messages in thread
From: Ben Hutchings @ 2026-03-17 14:16 UTC (permalink / raw)
  To: Sasha Levin, patches; +Cc: Salah Triki, Vineeth Vijayan, Heiko Carstens, stable

[-- Attachment #1: Type: text/plain, Size: 1351 bytes --]

On Sat, 2026-02-28 at 13:15 -0500, Sasha Levin wrote:
> From: Salah Triki <salah.triki@gmail.com>
> 
> [ Upstream commit f65c75b0b9b5a390bc3beadcde0a6fbc3ad118f7 ]
> 
> `css_alloc_subchannel()` calls `device_initialize()` before setting up
> the DMA masks. If `dma_set_coherent_mask()` or `dma_set_mask()` fails,
> the error path frees the subchannel structure directly, bypassing
> the device model reference counting.
> 
> Once `device_initialize()` has been called, the embedded struct device
> must be released via `put_device()`, allowing the release callback to
> free the container structure.

But in 5.10, the error path is only used *before* device_initialize()
has been called.  So it is absolutely wrong to call put_device().

> Fix the error path by dropping the initial device reference with
> `put_device()` instead of calling `kfree()` directly.
> 
> This ensures correct device lifetime handling and avoids potential
> use-after-free or double-free issues.
> 
> Fixes: e5dcf0025d7af ("s390/css: move subchannel lock allocation")
[...]

The bug actually seems to have been introduced in 5.12 by commit
4520a91a976e "s390/cio: use dma helpers for setting masks".

So please revert this for 5.10.

Ben.

-- 
Ben Hutchings
For every complex problem
there is a solution that is simple, neat, and wrong.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2026-03-17 14:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260228181736.1605592-1-sashal@kernel.org>
2026-02-28 18:16 ` [PATCH 5.10 054/147] regulator: core: Use ktime_get_boottime() to determine how long a regulator was off Sasha Levin
     [not found] ` <20260228181736.1605592-5-sashal@kernel.org>
2026-03-17 13:13   ` [PATCH 5.10 005/147] i3c: remove i2c board info from i2c_dev_desc Ben Hutchings
     [not found] ` <20260228181736.1605592-22-sashal@kernel.org>
2026-03-17 14:16   ` [PATCH 5.10 022/147] s390/cio: Fix device lifecycle handling in css_alloc_subchannel() Ben Hutchings

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