lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4e28affd89ba8a852e0fb7ace076458b3d43839a.camel@intel.com>
Date:   Tue, 17 Nov 2020 15:18:57 +0800
From:   Zhang Rui <rui.zhang@...el.com>
To:     Mukesh Ojha <mojha@...eaurora.org>, linux-pm@...r.kernel.org,
        linux-kernel@...r.kernel.org
Cc:     daniel.lezcano@...aro.org, amitk@...nel.org
Subject: Re: [PATCH] thermal: Fix NULL pointer dereference issue

On Mon, 2020-11-16 at 21:59 +0530, Mukesh Ojha wrote:
> Cooling stats variable inside thermal_cooling_device_stats_update()
> can get NULL. We should add a NULL check on stat inside for sanity.
> 
> Signed-off-by: Mukesh Ojha <mojha@...eaurora.org>
> ---
>  drivers/thermal/thermal_sysfs.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/thermal/thermal_sysfs.c
> b/drivers/thermal/thermal_sysfs.c
> index a6f371f..f52708f 100644
> --- a/drivers/thermal/thermal_sysfs.c
> +++ b/drivers/thermal/thermal_sysfs.c
> @@ -754,6 +754,9 @@ void thermal_cooling_device_stats_update(struct
> thermal_cooling_device *cdev,
>  {
>  	struct cooling_dev_stats *stats = cdev->stats;
>  
> +	if (!stats)
> +		return;
> +
May I know in which case stats can be NULL?
The only possibility I can see is that cdev->ops->get_max_state() fails
in cooling_device_stats_setup(), right?

thanks,
rui

>  	spin_lock(&stats->lock);
>  
>  	if (stats->state == new_state)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ