From: Guenter Roeck <linux@roeck-us.net>
To: Henry Martin <bsdhenrymartin@gmail.com>, wim@linux-watchdog.org
Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] watchdog: lenovo_se30_wdt: Fix null-ptr-deref in lenovo_se30_wdt_probe()
Date: Thu, 24 Apr 2025 05:10:05 -0700 [thread overview]
Message-ID: <e5b126df-a311-49e5-bf6f-fe59dd083bb2@roeck-us.net> (raw)
In-Reply-To: <20250424071648.89016-1-bsdhenrymartin@gmail.com>
On 4/24/25 00:16, Henry Martin wrote:
> devm_ioremap() returns NULL on error. Currently, lenovo_se30_wdt_probe()
> does not check for this case, which results in a NULL pointer
> dereference.
>
> Add NULL check after devm_ioremap() to prevent this issue.
>
> Fixes: c284153a2c55 ("watchdog: lenovo_se30_wdt: Watchdog driver for Lenovo SE30 platform")
> Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/lenovo_se30_wdt.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/watchdog/lenovo_se30_wdt.c b/drivers/watchdog/lenovo_se30_wdt.c
> index 024b842499b3..1c73bb7eeeee 100644
> --- a/drivers/watchdog/lenovo_se30_wdt.c
> +++ b/drivers/watchdog/lenovo_se30_wdt.c
> @@ -271,6 +271,8 @@ static int lenovo_se30_wdt_probe(struct platform_device *pdev)
> return -EBUSY;
>
> priv->shm_base_addr = devm_ioremap(dev, base_phys, SHM_WIN_SIZE);
> + if (!priv->shm_base_addr)
> + return -ENOMEM;
>
> priv->wdt_cfg.mod = WDT_MODULE;
> priv->wdt_cfg.idx = WDT_CFG_INDEX;
next prev parent reply other threads:[~2025-04-24 12:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-24 7:16 [PATCH v1] watchdog: lenovo_se30_wdt: Fix null-ptr-deref in lenovo_se30_wdt_probe() Henry Martin
2025-04-24 12:10 ` Guenter Roeck [this message]
2025-04-25 7:20 ` Markus Elfring
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=e5b126df-a311-49e5-bf6f-fe59dd083bb2@roeck-us.net \
--to=linux@roeck-us.net \
--cc=bsdhenrymartin@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@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