mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Manank Patel <pmanank200502@gmail.com>
Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers: watchdog: exar_wdt.c fix use after free
Date: Thu, 13 Oct 2022 06:53:10 -0700	[thread overview]
Message-ID: <29536273-4cd5-5530-083a-c8b8e42e1eb1@roeck-us.net> (raw)
In-Reply-To: <20221013095439.1425108-1-pmanank200502@gmail.com>

On 10/13/22 02:54, Manank Patel wrote:
> fix use after free by storing the result of PTR_ERR(n->pdev)
> to a local variable before returning.
> 
> Signed-off-by: Manank Patel <pmanank200502@gmail.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>   drivers/watchdog/exar_wdt.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/watchdog/exar_wdt.c b/drivers/watchdog/exar_wdt.c
> index 35058d8b21bc..7c61ff343271 100644
> --- a/drivers/watchdog/exar_wdt.c
> +++ b/drivers/watchdog/exar_wdt.c
> @@ -355,8 +355,10 @@ static int __init exar_wdt_register(struct wdt_priv *priv, const int idx)
>   						    &priv->wdt_res, 1,
>   						    priv, sizeof(*priv));
>   	if (IS_ERR(n->pdev)) {
> +		int err = PTR_ERR(n->pdev);
> +
>   		kfree(n);
> -		return PTR_ERR(n->pdev);
> +		return err;
>   	}
>   
>   	list_add_tail(&n->list, &pdev_list);


      reply	other threads:[~2022-10-13 13:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-13  9:54 Manank Patel
2022-10-13 13:53 ` Guenter Roeck [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=29536273-4cd5-5530-083a-c8b8e42e1eb1@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=pmanank200502@gmail.com \
    /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®