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-next>] [day] [month] [year] [list]
Message-Id: <20241126212414.15165-1-rafael.v.volkmer@gmail.com>
Date: Tue, 26 Nov 2024 18:24:14 -0300
From: "Rafael V. Volkmer" <rafael.v.volkmer@...il.com>
To: Uwe Kleine-König <ukleinek@...nel.org>
Cc: linux-pwm@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	"Rafael V. Volkmer" <rafael.v.volkmer@...il.com>
Subject: [PATCH 2/2] pwm: correct pwm->state.enabled handling to allow fops control

Ensure pwm->state.enabled is consistently updated during enable and
disable operations in ehrpwm_pwm_apply() to resolve this issue.

Previously, when attempting to interact with the ti PWM driver through
fops, the pwm->state.enabled field was not updated correctly after
applying enable or disable. This led to a state mismatch where the
driver's state detection logic prevented disabling the PWM through
fops once it had been activated.

Signed-off-by: Rafael V. Volkmer <rafael.v.volkmer@...il.com>
---
 drivers/pwm/pwm-tiehrpwm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c
index 0125e73b98df..9f939d535440 100644
--- a/drivers/pwm/pwm-tiehrpwm.c
+++ b/drivers/pwm/pwm-tiehrpwm.c
@@ -420,6 +420,7 @@ static int ehrpwm_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
 	if (!state->enabled) {
 		if (enabled)
 			ehrpwm_pwm_disable(chip, pwm);
+			pwm->state.enabled = false;
 		return 0;
 	}
 
@@ -429,6 +430,7 @@ static int ehrpwm_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
 
 	if (!enabled)
 		err = ehrpwm_pwm_enable(chip, pwm);
+		pwm->state.enabled = true;
 
 	return err;
 }
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ