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]
Date:   Wed, 8 Mar 2023 00:00:14 +0300
From:   George Stark <gnstark@...rdevices.ru>
To:     <thierry.reding@...il.com>, <u.kleine-koenig@...gutronix.de>,
        <krzysztof.kozlowski@...aro.org>, <alim.akhtar@...sung.com>
CC:     <linux-pwm@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-samsung-soc@...r.kernel.org>, <kernel@...rdevices.ru>,
        <gnstark@...rdevices.ru>, George Stark <GNStark@...rdevices.ru>
Subject: [RFC PATCH v1] Revert "pwm: Clear chip_data in pwm_put()"

From: George Stark <GNStark@...rdevices.ru>

This reverts commit e926b12c611c2095c7976e2ed31753ad6eb5ff1a.

There're several issues with the original change:

- it breaks generic semantics of set_driver_data-like routines that
only client code controls lifetime of it's own data.

- it breaks pwm-sti.c driver: pwm_set_chip_data is used only in probe stage
then pwm_get_chip_data used in capture callback

Change-Id: I5787c6b4c520d4a0997567c416b26fa4e0806b94
Signed-off-by: George Stark <GNStark@...rdevices.ru>
---
 drivers/pwm/core.c        | 1 -
 drivers/pwm/pwm-berlin.c  | 1 +
 drivers/pwm/pwm-samsung.c | 1 +
 3 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index e01147f66e15..3bc644cc16fe 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -1036,7 +1036,6 @@ void pwm_put(struct pwm_device *pwm)
 	if (pwm->chip->ops->free)
 		pwm->chip->ops->free(pwm->chip, pwm);
 
-	pwm_set_chip_data(pwm, NULL);
 	pwm->label = NULL;
 
 	module_put(pwm->chip->ops->owner);
diff --git a/drivers/pwm/pwm-berlin.c b/drivers/pwm/pwm-berlin.c
index e157273fd2f7..953cc2bba314 100644
--- a/drivers/pwm/pwm-berlin.c
+++ b/drivers/pwm/pwm-berlin.c
@@ -84,6 +84,7 @@ static void berlin_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm)
 {
 	struct berlin_pwm_channel *channel = pwm_get_chip_data(pwm);
 
+	pwm_set_chip_data(pwm, NULL);
 	kfree(channel);
 }
 
diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c
index 9c5b4f515641..7e5dbdd6fc64 100644
--- a/drivers/pwm/pwm-samsung.c
+++ b/drivers/pwm/pwm-samsung.c
@@ -249,6 +249,7 @@ static int pwm_samsung_request(struct pwm_chip *chip, struct pwm_device *pwm)
 static void pwm_samsung_free(struct pwm_chip *chip, struct pwm_device *pwm)
 {
 	kfree(pwm_get_chip_data(pwm));
+	pwm_set_chip_data(pwm, NULL);
 }
 
 static int pwm_samsung_enable(struct pwm_chip *chip, struct pwm_device *pwm)
-- 
2.38.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ