[PATCH] watchdog:alim1535_wdt: Fix data race in ali_settimer() concerning ali_timeout_bits variable. variable.
From: Mark Balantzyan
Date: Thu Jul 18 2019 - 11:52:56 EST
---
drivers/watchdog/alim1535_wdt.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/watchdog/alim1535_wdt.c b/drivers/watchdog/alim1535_wdt.c
index 60f0c2eb..4ba2b860 100644
--- a/drivers/watchdog/alim1535_wdt.c
+++ b/drivers/watchdog/alim1535_wdt.c
@@ -107,6 +107,7 @@ static void ali_keepalive(void)
static int ali_settimer(int t)
{
+ spin_lock(&ali_lock);
if (t < 0)
return -EINVAL;
else if (t < 60)
@@ -117,7 +118,7 @@ static int ali_settimer(int t)
ali_timeout_bits = (t / 300)|(1 << 6)|(1 << 7);
else
return -EINVAL;
-
+ spin_unlock(&ali_lock);
timeout = t;
return 0;
}
--
2.17.1
Signed-off-by: Mark Balantzyan <mbalant3@xxxxxxxxx>
Cc: Pavel Andrianov <andrianov@xxxxxxxxx>
Cc:Wim Van Sebroeck <wim@xxxxxxxxxxxxxxxxxx> (maintainer:WATCHDOG DEVICE DRIVERS)
Cc: Guenter Roeck <linux@xxxxxxxxxxxx> (maintainer:WATCHDOG DEVICE DRIVERS)
Cc:linux-watchdog@xxxxxxxxxxxxxxx (open list:WATCHDOG DEVICE DRIVERS)
Cc:linux-kernel@xxxxxxxxxxxxxxx (open list)