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: <1487785285-3567-2-git-send-email-harald@ccbib.org>
Date:   Wed, 22 Feb 2017 17:41:25 +0000
From:   Harald Geyer <harald@...ib.org>
To:     Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>, Tejun Heo <tj@...nel.org>,
        Lai Jiangshan <jiangshanlai@...il.com>
Cc:     linux-kernel@...r.kernel.org, Harald Geyer <harald@...ib.org>
Subject: [PATCH 2/2] regulator: core: Fix race on multiple calls to regulator_disable_deferred()

The old code has two issues:
1) When multiple consumers call regulator_disable_deferred() close in time,
always the delay requested in the first call is used.
2) When a consumer calls regulator_disable_deferred(), but enables and
calls regulator_disable_deferred() again before the timer fires, the timer
isn't reset.

Both issues can cause the regulator to get disabled early.

Signed-off-by: Harald Geyer <harald@...ib.org>
---
 drivers/regulator/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index cc68604..ce4923b 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2449,8 +2449,8 @@ int regulator_disable_deferred(struct regulator *regulator, int ms)
 	rdev->deferred_disables++;
 	mutex_unlock(&rdev->mutex);
 
-	queue_delayed_work(system_power_efficient_wq, &rdev->disable_work,
-			   msecs_to_jiffies(ms));
+	mod_fwd_delayed_work(system_power_efficient_wq, &rdev->disable_work,
+			     msecs_to_jiffies(ms));
 	return 0;
 }
 EXPORT_SYMBOL_GPL(regulator_disable_deferred);
-- 
2.1.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ