From: sashiko-bot@kernel.org
To: "Paul Louvel" <paul.louvel@bootlin.com>
Cc: linux-watchdog@vger.kernel.org
Subject: Re: [PATCH v2 8/8] watchdog: w83627hf_wdt: Report all initialization failures in probe
Date: Sun, 26 Jul 2026 18:56:46 +0000 [thread overview]
Message-ID: <20260726185646.DC2001F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260726-w83627hf_wdt-improvements-v2-8-3645a2a6c022@bootlin.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Unchecked dereferences of `id` and `pdata` in probe can lead to a kernel Oops.
--
--- Patch [8]: [PATCH v2 8/8] watchdog: w83627hf_wdt: Report all initialization failures in probe ---
commit 0129cf43f51e4968c683b359d971eaa0c48a6846
Author: Paul Louvel <paul.louvel@bootlin.com>
watchdog: w83627hf_wdt: Report all initialization failures in probe
The driver currently logs an error only if the chip initialization
fails. Extend the error reporting to all failure paths in probe to
improve diagnostics.
> diff --git a/drivers/watchdog/w83627hf_wdt.c b/drivers/watchdog/w83627hf_wdt.c
> index 2957364485ebf..7b50865ae8248 100644
> --- a/drivers/watchdog/w83627hf_wdt.c
> +++ b/drivers/watchdog/w83627hf_wdt.c
> @@ -485,7 +485,8 @@ static int wdt_probe(struct platform_device *pdev)
>
> res = platform_get_resource(pdev, IORESOURCE_IO, 0);
> if (!res)
> - return -ENXIO;
> + return dev_err_probe(dev, -ENXIO,
> + "failed to get I/O resource\n");
[Severity: High]
Could the dereferences of id and pdata earlier in this function lead to a
kernel Oops?
If a user binds a device to this driver via sysfs (for example, using
driver_override or bind), platform_get_device_id(pdev) will return NULL
because the device ID does not match any entry in the driver's id_table.
This leads to a NULL pointer dereference when initializing chip:
wdt_probe()
const struct platform_device_id *id = platform_get_device_id(pdev);
...
enum chips chip = id->driver_data;
Additionally, binding a platform device this way leaves
pdev->dev.platform_data as NULL, causing a subsequent NULL pointer
dereference when accessing pdata:
wdt_probe()
const struct wdt_pdata *pdata = pdev->dev.platform_data;
...
data->siocfg_enter = pdata->siocfg_enter;
Since this can be triggered from userspace by a user with privileges to
write to sysfs, could this be used to panic the kernel?
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260726-w83627hf_wdt-improvements-v2-0-3645a2a6c022@bootlin.com?part=8
prev parent reply other threads:[~2026-07-26 18:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-26 18:44 [PATCH v2 0/8] watchdog: w83627hf_wdt: Convert driver to the driver model and add minute support Paul Louvel
2026-07-26 18:44 ` [PATCH v2 1/8] watchdog: w83627hf_wdt: Replace magic numbers with descriptive macros Paul Louvel
2026-07-26 18:44 ` [PATCH v2 2/8] watchdog: w83627hf_wdt: Convert to platform driver model Paul Louvel
2026-07-26 18:57 ` sashiko-bot
2026-07-26 18:44 ` [PATCH v2 3/8] watchdog: w83627hf_wdt: Use private driver data structure Paul Louvel
2026-07-26 18:44 ` [PATCH v2 4/8] watchdog: w83627hf_wdt: Move register offsets into driver data Paul Louvel
2026-07-26 18:44 ` [PATCH v2 5/8] watchdog: w83627hf_wdt: Add Super I/O configuration port as a platform device resource Paul Louvel
2026-07-26 18:56 ` sashiko-bot
2026-07-27 1:08 ` Guenter Roeck
2026-07-26 18:44 ` [PATCH v2 6/8] watchdog: w83627hf_wdt: Store Super I/O unlocking sequence in platform data Paul Louvel
2026-07-26 18:55 ` sashiko-bot
2026-07-26 18:44 ` [PATCH v2 7/8] watchdog: w83627hf_wdt: Add minute mode counting Paul Louvel
2026-07-26 18:44 ` [PATCH v2 8/8] watchdog: w83627hf_wdt: Report all initialization failures in probe Paul Louvel
2026-07-26 18:56 ` sashiko-bot [this message]
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=20260726185646.DC2001F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=paul.louvel@bootlin.com \
--cc=sashiko-reviews@lists.linux.dev \
/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