From: Jiale Yao <yaojiale02@163.com>
To: Wim Van Sebroeck <wim@linux-watchdog.org>,
Guenter Roeck <linux@roeck-us.net>,
Florian Fainelli <florian.fainelli@telecomint.eu>,
linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH 6/6] watchdog: rdc321x: initialize device state before registration
Date: Wed, 28 Oct 2026 12:48:26 +0800 [thread overview]
Message-ID: <20261028044828.96177-7-yaojiale02@163.com> (raw)
In-Reply-To: <20261028044828.96177-1-yaojiale02@163.com>
misc_register() exposes the watchdog before its lock, completion, and
timer are initialized. A userspace operation racing probe can therefore
use any of these objects before it is ready.
Finish initializing the watchdog state before registering the misc
device.
Fixes: b3e8f2c13ae9 ("[WATCHDOG] Add support for the built-int RDC R-321x SoC watchdog")
Cc: stable@vger.kernel.org
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
drivers/watchdog/rdc321x_wdt.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/watchdog/rdc321x_wdt.c b/drivers/watchdog/rdc321x_wdt.c
index 8955177072fa..a2520d8d5c90 100644
--- a/drivers/watchdog/rdc321x_wdt.c
+++ b/drivers/watchdog/rdc321x_wdt.c
@@ -233,12 +233,6 @@ static int rdc321x_wdt_probe(struct platform_device *pdev)
rdc321x_wdt_device.queue = 0;
rdc321x_wdt_device.default_ticks = ticks;
- err = misc_register(&rdc321x_wdt_misc);
- if (err < 0) {
- dev_err(&pdev->dev, "misc_register failed\n");
- return err;
- }
-
spin_lock_init(&rdc321x_wdt_device.lock);
/* Reset the watchdog */
@@ -251,6 +245,12 @@ static int rdc321x_wdt_probe(struct platform_device *pdev)
timer_setup(&rdc321x_wdt_device.timer, rdc321x_wdt_trigger, 0);
+ err = misc_register(&rdc321x_wdt_misc);
+ if (err < 0) {
+ dev_err(&pdev->dev, "misc_register failed\n");
+ return err;
+ }
+
dev_info(&pdev->dev, "watchdog init success\n");
return 0;
--
2.34.1
next prev parent reply other threads:[~2026-10-28 4:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 4:48 [PATCH 0/6] Initialize device state before userspace registration Jiale Yao
2026-10-28 4:48 ` [PATCH 1/6] aoe: initialize error message synchronization before registration Jiale Yao
2026-10-28 4:48 ` [PATCH 2/6] bus: fsl-mc: initialize UAPI state before device registration Jiale Yao
2026-10-28 4:48 ` [PATCH 3/6] Drivers: hv: initialize partition table " Jiale Yao
2026-10-28 4:48 ` [PATCH 4/6] misc: ibmvmc: initialize HMC state " Jiale Yao
2026-10-28 9:25 ` Arnd Bergmann
2026-10-28 10:05 ` Greg Kroah-Hartman
2026-10-28 4:48 ` [PATCH 5/6] s390/dcssblk: initialize device semaphore before sysfs registration Jiale Yao
2026-10-28 7:03 ` Heiko Carstens
2026-10-28 4:48 ` Jiale Yao [this message]
2026-10-28 14:53 ` [PATCH 6/6] watchdog: rdc321x: initialize device state before registration Guenter Roeck
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=20261028044828.96177-7-yaojiale02@163.com \
--to=yaojiale02@163.com \
--cc=florian.fainelli@telecomint.eu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=stable@vger.kernel.org \
--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®