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] [day] [month] [year] [list]
Message-ID: <CAJZ5v0goKF1Pn8fJBcRLtbQ0cMpSKR2PS4asbNjf_XTJZG-2-w@mail.gmail.com>
Date:   Wed, 29 Mar 2023 15:57:21 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Zhang Rui <rui.zhang@...el.com>
Cc:     linux-pm@...r.kernel.org, rafael.j.wysocki@...el.com,
        daniel.lezcano@...aro.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 -next] thermal/drivers/thermal_hwmon: Fix a kernel NULL
 pointer dereference

On Wed, Mar 29, 2023 at 2:26 PM Zhang Rui <rui.zhang@...el.com> wrote:
>
> When the hwmon device node of a thermal zone device is not found,
> using hwmon->device causes a kernel NULL pointer dereference.
>
> Skip removing hwmon device for thermal zones without hwmon device, and
> fix the kernel NULL pointer dereference when hwmon device is not found.
>
> Fixes: dec07d399cc8 ("thermal: Don't use 'device' internal thermal zone structure field")
> Reported-by: Preble Adam C <adam.c.preble@...el.com>

Do you have a link to the bug report?  I'm wondering where exactly it triggers.

> Signed-off-by: Zhang Rui <rui.zhang@...el.com>
> ---
> v1 -> v2
>    Add check for devices without hwmon device.
>    Use pr_debug instead of dev_dbg.
> ---
>  drivers/thermal/thermal_hwmon.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c
> index c59db17dddd6..1cdee2ee8d4d 100644
> --- a/drivers/thermal/thermal_hwmon.c
> +++ b/drivers/thermal/thermal_hwmon.c
> @@ -226,10 +226,12 @@ void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
>         struct thermal_hwmon_device *hwmon;
>         struct thermal_hwmon_temp *temp;
>
> +       if (tz->tzp && tz->tzp->no_hwmon)
> +               return;
> +
>         hwmon = thermal_hwmon_lookup_by_type(tz);
>         if (unlikely(!hwmon)) {
> -               /* Should never happen... */
> -               dev_dbg(hwmon->device, "hwmon device lookup failed!\n");
> +               pr_debug("hwmon device lookup failed!\n");
>                 return;
>         }
>
> --

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ