linux-samsung-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski@linaro.org>,
	"Wim Van Sebroeck" <wim@linux-watchdog.org>,
	"Doug Anderson" <dianders@chromium.org>,
	"Leela Krishna Amudala" <leela.krishna@linaro.org>
Cc: Alim Akhtar <alim.akhtar@samsung.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org,
	linux-watchdog@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH 01/34] watchdog: s3c2410: Don't skip cleanup in remove's error path
Date: Sat, 4 Mar 2023 08:58:29 -0800	[thread overview]
Message-ID: <8a618518-ce20-9244-19ab-6badcd3cdf12@roeck-us.net> (raw)
In-Reply-To: <20230303213716.2123717-2-u.kleine-koenig@pengutronix.de>

Hi Uwe,

On 3/3/23 13:36, Uwe Kleine-König wrote:
> Returning early in a platform driver's remove callback is wrong. In this
> case the watchdog device is never removed although it's parent is gone
> which likely can trigger a use-after-free in sysfs. Also the two used
> clocks will never be disabled.
> 
> Instead only warn if s3c2410wdt_enable() fails and cleanup. Note that
> returning 0 is the right thing to do then to suppress another warning
> message by the driver core.
> 
> Fixes: 4f1f653a68d6 ("watchdog: s3c2410_wdt: use syscon regmap interface to configure pmu register")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>   drivers/watchdog/s3c2410_wdt.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
> index 200ba236a72e..cf104a844a43 100644
> --- a/drivers/watchdog/s3c2410_wdt.c
> +++ b/drivers/watchdog/s3c2410_wdt.c
> @@ -782,7 +782,8 @@ static int s3c2410wdt_remove(struct platform_device *dev)
>   
>   	ret = s3c2410wdt_enable(wdt, false);
>   	if (ret < 0)
> -		return ret;
> +		dev_warn(&dev->dev,
> +			 "Failed to disable watchdog (%pe)\n", ERR_PTR(ret));
>   
>   	watchdog_unregister_device(&wdt->wdt_device);
>   

I sent out two patches a minute ago which should make this patch
as well as the use of the remove_new callback unnecessary.

Guenter


  reply	other threads:[~2023-03-04 16:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
2023-03-03 21:36 ` [PATCH 01/34] watchdog: s3c2410: Don't skip cleanup in remove's error path Uwe Kleine-König
2023-03-04 16:58   ` Guenter Roeck [this message]
2023-03-03 21:37 ` [PATCH 28/34] watchdog: s3c2410: Convert to platform remove callback returning void Uwe Kleine-König
2023-03-04 17:12   ` Guenter Roeck
2023-03-06 17:05 ` [PATCH 00/34] watchdog: " Uwe Kleine-König
2023-03-14  8:38 ` Naresh Kamboju

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=8a618518-ce20-9244-19ab-6badcd3cdf12@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=alim.akhtar@samsung.com \
    --cc=dianders@chromium.org \
    --cc=kernel@pengutronix.de \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=leela.krishna@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    --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;
as well as URLs for NNTP newsgroup(s).