Skip to content

watchdog: msc313e: Fix issues Sashiko reported

Tzung-Bi Shih linux-watchdog lkml 2 versions – Applied

Status from this message: Applied.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest9 patches 12 repliesApplied
  2. v12 patches 4 repliesApplied

Changes in v2 from the cover letter

- Add some more fixes to the series.

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/9watchdog: msc313e: Fix NULL pointer dereference in PM callbacksdrivers/watchdog/msc313e_wdt.c+1 -01 reply
2/9watchdog: msc313e: Avoid division by zerodrivers/watchdog/msc313e_wdt.c+5 -11 reply
3/9watchdog: msc313e: Fix clock leak and spurious timer in settimeout()drivers/watchdog/msc313e_wdt.c+16 -61 reply
4/9watchdog: msc313e: Enable clock before accessing hardware registersdrivers/watchdog/msc313e_wdt.c+21 -22 replies
5/9watchdog: msc313e: Fix spurious reset on suspenddrivers/watchdog/msc313e_wdt.c+3 -22 replies
6/9watchdog: msc313e: Fix undefined behaviordrivers/watchdog/msc313e_wdt.c+11 -11 reply
7/9watchdog: msc313e: Sync timeout value if WDT was running at bootdrivers/watchdog/msc313e_wdt.c+9 -81 reply
8/9watchdog: msc313e: Propagate error code in resume()drivers/watchdog/msc313e_wdt.c+11 -31 reply
9/9watchdog: msc313e: Replace commas with semicolons in probe()drivers/watchdog/msc313e_wdt.c+2 -21 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/9] watchdog: msc313e: Fix issues Sashiko reported

The series mainly fixes issues reported by Sashiko in [1][2][3].

Patch 1 fixes a report in [1]:
- "[High] Missing platform_set_drvdata() or dev_set_drvdata() in the probe function leads to a guaranteed NULL pointer dereference during suspend/resume operations."

Patch 2 fixes reports in both [2][3]:
- "[High] Potential division by zero during max_timeout calculation."
- "[High] Potential division by zero if clk_get_rate() returns 0."

Patch 3 fixes reports in both [2][3]:
- "Clock reference count leak and unintended hardware activation in msc313e_wdt_settimeout."
- "[High] Repeatedly setting the watchdog timeout leaks clock prepare and enable references, potentially leading to refcount overflow."

Patch 4 fixes a report in [1]:
- "[High] The driver accesses hardware registers without ensuring the required clock is enabled, which can lead to a synchronous bus fault."
It also fixes a further report in [3]:
- "[Medium] Clock reference count is leaked on the probe error path if watchdog registration fails."

Patch 5 fixes reports in both [2][3]:
- "[High] Hardware watchdog is not properly stopped during system suspend if it was started by the bootloader but not opened by userspace."
- "[High] System will unexpectedly reset during suspend if the hardware watchdog is running but was never opened by userspace."

Patch 6 fixes an undefined behavior while I was reviewing the code.

Patch 7 fixes a report from a local AI tool. If WDT was running at boot, the timeout value could be inconsistent with what the driver has. Sync the value.

Patch 8 fixes a report in [2]:
- "[High] The resume callback ignores the return value of msc313e_wdt_start()."

Patch 9 fixes a report in [2]:
- "[Low] Struct initialization uses commas instead of semicolons."

[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
[3] https://lore.kernel.org/all/[email protected]/
---
Patch 1 seems to be applied[4]. But the tree isn't available yet. The series still bases on current watchdog-next branch.

[4] https://lore.kernel.org/all/[email protected]
---
v2:
- Add some more fixes to the series.

v1: https://lore.kernel.org/r/[email protected]

Tzung-Bi Shih (9):
watchdog: msc313e: Fix NULL pointer dereference in PM callbacks
watchdog: msc313e: Avoid division by zero
watchdog: msc313e: Fix clock leak and spurious timer in settimeout()
watchdog: msc313e: Enable clock before accessing hardware registers
watchdog: msc313e: Fix spurious reset on suspend
watchdog: msc313e: Fix undefined behavior
watchdog: msc313e: Sync timeout value if WDT was running at boot
watchdog: msc313e: Propagate error code in resume()
watchdog: msc313e: Replace commas with semicolons in probe()

 drivers/watchdog/msc313e_wdt.c | 90 +++++++++++++++++++++++++++-------
 1 file changed, 72 insertions(+), 18 deletions(-)
Signature · 1 line
2.53.0