67 lines
2.2 KiB
Diff
67 lines
2.2 KiB
Diff
From d2a99ecf2d0479f78a21568eee08f4ca27652629 Mon Sep 17 00:00:00 2001
|
|
From: Guenter Roeck <linux@roeck-us.net>
|
|
Date: Sun, 17 Aug 2025 07:48:17 -0700
|
|
Subject: watchdog: intel_oc_wdt: Do not try to write into const memory
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
The code tries to update the intel_oc_wdt_info data structure if the
|
|
watchdog is locked. That data structure is marked as const and can not
|
|
be written into. Copy it into struct intel_oc_wdt and modify it there
|
|
to fix the problem.
|
|
|
|
Reported-by: Petar Kulić <cooleech@gmail.com>
|
|
Cc: Diogo Ivo <diogo.ivo@siemens.com>
|
|
Fixes: 535d1784d8a9 ("watchdog: Add driver for Intel OC WDT")
|
|
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
---
|
|
drivers/watchdog/intel_oc_wdt.c | 8 ++++----
|
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
|
|
--- a/drivers/watchdog/intel_oc_wdt.c
|
|
+++ b/drivers/watchdog/intel_oc_wdt.c
|
|
@@ -41,6 +41,7 @@
|
|
struct intel_oc_wdt {
|
|
struct watchdog_device wdd;
|
|
struct resource *ctrl_res;
|
|
+ struct watchdog_info info;
|
|
bool locked;
|
|
};
|
|
|
|
@@ -115,7 +116,6 @@ static const struct watchdog_ops intel_o
|
|
|
|
static int intel_oc_wdt_setup(struct intel_oc_wdt *oc_wdt)
|
|
{
|
|
- struct watchdog_info *info;
|
|
unsigned long val;
|
|
|
|
val = inl(INTEL_OC_WDT_CTRL_REG(oc_wdt));
|
|
@@ -134,7 +134,6 @@ static int intel_oc_wdt_setup(struct int
|
|
set_bit(WDOG_HW_RUNNING, &oc_wdt->wdd.status);
|
|
|
|
if (oc_wdt->locked) {
|
|
- info = (struct watchdog_info *)&intel_oc_wdt_info;
|
|
/*
|
|
* Set nowayout unconditionally as we cannot stop
|
|
* the watchdog.
|
|
@@ -145,7 +144,7 @@ static int intel_oc_wdt_setup(struct int
|
|
* and inform the core we can't change it.
|
|
*/
|
|
oc_wdt->wdd.timeout = (val & INTEL_OC_WDT_TOV) + 1;
|
|
- info->options &= ~WDIOF_SETTIMEOUT;
|
|
+ oc_wdt->info.options &= ~WDIOF_SETTIMEOUT;
|
|
|
|
dev_info(oc_wdt->wdd.parent,
|
|
"Register access locked, heartbeat fixed at: %u s\n",
|
|
@@ -193,7 +192,8 @@ static int intel_oc_wdt_probe(struct pla
|
|
wdd->min_timeout = INTEL_OC_WDT_MIN_TOV;
|
|
wdd->max_timeout = INTEL_OC_WDT_MAX_TOV;
|
|
wdd->timeout = INTEL_OC_WDT_DEF_TOV;
|
|
- wdd->info = &intel_oc_wdt_info;
|
|
+ oc_wdt->info = intel_oc_wdt_info;
|
|
+ wdd->info = &oc_wdt->info;
|
|
wdd->ops = &intel_oc_wdt_ops;
|
|
wdd->parent = dev;
|
|
|