mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Rosen Penev <rosenp@gmail.com>, linux-watchdog@vger.kernel.org
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>,
	linusw@kernel.org, open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] watchdog: core: assign parent with devm registration
Date: Sun, 24 May 2026 08:22:52 -0700	[thread overview]
Message-ID: <c6375856-be1b-4c87-9673-e59bd3278718@roeck-us.net> (raw)
In-Reply-To: <20260524022332.179202-1-rosenp@gmail.com>

On 5/23/26 19:23, Rosen Penev wrote:
> If the user did not pass a parent in the struct watchdog_device
> then use the device used for devres as parent.
> 
> This is quite intuitive and can help avoiding having to
> assign parent explicitly in every driver using devres
> to add the watchdog_device.
> 
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
>   Linus: hope you don't mind me flat out copying the description from
>   https://lore.kernel.org/all/20260427-gpio-mmio-more-v3-1-fe1882351424@kernel.org/
>   drivers/watchdog/watchdog_core.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c
> index 8300520688d0..726c85debabc 100644
> --- a/drivers/watchdog/watchdog_core.c
> +++ b/drivers/watchdog/watchdog_core.c
> @@ -440,6 +440,13 @@ int devm_watchdog_register_device(struct device *dev,
>   	if (!rcwdd)
>   		return -ENOMEM;
>   
> +	/*
> +	 * We are passing the devres device here so if the user did not pass
> +	 * another parent, it's this one.
> +	 */
> +	if (!wdd->parent)
> +		wdd->parent = dev;
> +

I understand that you consider it to be garbage, but in my opinion Sashiko has a
point. If the watchdog device data structure is static, wdd->parent will be retained
over multiple remove/reinsert instantiations of the driver, which in turn would result
in subsequent UAF. That means I can not accept your patch.

Guenter


  reply	other threads:[~2026-05-24 15:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-24  2:23 Rosen Penev
2026-05-24 15:22 ` Guenter Roeck [this message]
2026-05-27 16:25   ` Linus Walleij

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=c6375856-be1b-4c87-9673-e59bd3278718@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=linusw@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=rosenp@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®