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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230226013722.1802842-1-kamatam@amazon.com>
Date:   Sat, 25 Feb 2023 17:37:21 -0800
From:   Munehisa Kamata <kamatam@...zon.com>
To:     <thierry.reding@...il.com>
CC:     <u.kleine-koenig@...gutronix.de>, <tobetter@...il.com>,
        <linux-pwm@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        Munehisa Kamata <kamatam@...zon.com>, <stable@...r.kernel.org>
Subject: [PATCH] pwm: core: Zero-initialize the temp state

Zero-initialize the on-stack structure to avoid unexpected behaviors. Some
drivers may not set or initialize all the values in pwm_state through their
.get_state() callback and therefore some random values may remain there and
be set into pwm->state eventually.

This actually caused regression on ODROID-N2+ as reported in [1]; kernel
fails to boot due to random panic or hang-up.

[1] https://forum.odroid.com/viewtopic.php?f=177&t=46360

Fixes: c73a3107624d ("pwm: Handle .get_state() failures")
Cc: stable@...r.kernel.org # 6.2
Signed-off-by: Munehisa Kamata <kamatam@...zon.com>
---
 drivers/pwm/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index e01147f66e15..6eac8022a2c2 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -117,6 +117,7 @@ static int pwm_device_request(struct pwm_device *pwm, const char *label)
 	if (pwm->chip->ops->get_state) {
 		struct pwm_state state;
 
+		memset(&state, 0, sizeof(struct pwm_state));
 		err = pwm->chip->ops->get_state(pwm->chip, pwm, &state);
 		trace_pwm_get(pwm, &state, err);
 
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ