mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Wim Van Sebroeck <wim@linux-watchdog.org>,
	Guenter Roeck <linux@roeck-us.net>
Cc: Daniel Palmer <daniel@thingy.jp>,
	Romain Perier <romain.perier@gmail.com>,
	linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org,
	tzungbi@kernel.org
Subject: [PATCH v2 0/9] watchdog: msc313e: Fix issues Sashiko reported
Date: Sat, 29 Aug 2026 00:13:39 +0800	[thread overview]
Message-ID: <20260828161348.13212-1-tzungbi@kernel.org> (raw)

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/20260826062035.7645D1F000E9@smtp.kernel.org/
[2] https://lore.kernel.org/all/20260827045746.C79091F000E9@smtp.kernel.org/
[3] https://lore.kernel.org/all/20260827050107.9AD441F000E9@smtp.kernel.org/
---
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/666397f1-ac63-4644-9de1-9f675d2a7f3a@roeck-us.net
---
v2:
- Add some more fixes to the series.

v1: https://lore.kernel.org/r/20260827044700.554333-1-tzungbi@kernel.org

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(-)

-- 
2.53.0


             reply	other threads:[~2026-08-28 16:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-28 16:13 Tzung-Bi Shih [this message]
2026-08-28 16:13 ` [PATCH v2 1/9] watchdog: msc313e: Fix NULL pointer dereference in PM callbacks Tzung-Bi Shih
2026-08-28 16:13 ` [PATCH v2 2/9] watchdog: msc313e: Avoid division by zero Tzung-Bi Shih
2026-08-28 16:13 ` [PATCH v2 3/9] watchdog: msc313e: Fix clock leak and spurious timer in settimeout() Tzung-Bi Shih
2026-08-28 16:13 ` [PATCH v2 4/9] watchdog: msc313e: Enable clock before accessing hardware registers Tzung-Bi Shih
2026-08-28 16:13 ` [PATCH v2 5/9] watchdog: msc313e: Fix spurious reset on suspend Tzung-Bi Shih
2026-08-28 16:13 ` [PATCH v2 6/9] watchdog: msc313e: Fix undefined behavior Tzung-Bi Shih
2026-08-28 16:13 ` [PATCH v2 7/9] watchdog: msc313e: Sync timeout value if WDT was running at boot Tzung-Bi Shih
2026-08-28 16:13 ` [PATCH v2 8/9] watchdog: msc313e: Propagate error code in resume() Tzung-Bi Shih
2026-08-28 16:13 ` [PATCH v2 9/9] watchdog: msc313e: Replace commas with semicolons in probe() Tzung-Bi Shih
2026-08-28 16:20 ` [PATCH v2 0/9] watchdog: msc313e: Fix issues Sashiko reported Daniel Palmer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260828161348.13212-1-tzungbi@kernel.org \
    --to=tzungbi@kernel.org \
    --cc=daniel@thingy.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=romain.perier@gmail.com \
    --cc=wim@linux-watchdog.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®