Re: [PATCH 01/12] watchdog: NULL the default governor if it is unregistered

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 19, 2019 at 03:37:00PM -0500, minyard@xxxxxxx wrote:
> From: Corey Minyard <cminyard@xxxxxxxxxx>
> 
> Otherwise it could be used after being freed.
> 
> Signed-off-by: Corey Minyard <cminyard@xxxxxxxxxx>
> ---
>  drivers/watchdog/watchdog_pretimeout.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/watchdog/watchdog_pretimeout.c b/drivers/watchdog/watchdog_pretimeout.c
> index 01ca84be240f..b45041b0ef39 100644
> --- a/drivers/watchdog/watchdog_pretimeout.c
> +++ b/drivers/watchdog/watchdog_pretimeout.c
> @@ -162,6 +162,8 @@ void watchdog_unregister_governor(struct watchdog_governor *gov)
>  			break;
>  		}
>  	}
> +	if (gov == default_gov)
> +		default_gov = NULL;
>  

Good catch.

I think this should be inside the spinlock. I do wonder though why it
was removed with commit da0d12ff2b82 ("watchdog: pretimeout: add panic
pretimeout governor"). I think it was wrong to remove it, but I may be
missing something. Vladimir, do you recall ?

Guenter

>  	spin_lock_irq(&pretimeout_lock);
>  	list_for_each_entry(p, &pretimeout_list, entry)
> -- 
> 2.17.1
> 



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux