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: <CAHc4DN+kb8w+VVX0XAfN5YVo9M+RBatKkv8-nOiOTA+7yZjmfA@mail.gmail.com>
Date: Mon, 14 Jul 2025 20:36:29 +0800
From: Hsin-Te Yuan <yuanhsinte@...omium.org>
To: Greg KH <gregkh@...uxfoundation.org>
Cc: Hsin-Te Yuan <yuanhsinte@...omium.org>, "Rafael J. Wysocki" <rafael@...nel.org>, 
	Daniel Lezcano <daniel.lezcano@...aro.org>, Amit Kucheria <amitk@...nel.org>, 
	Zhang Rui <rui.zhang@...el.com>, linux-pm@...r.kernel.org, 
	linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH 6.6] thermal/of: Fix mask mismatch when no trips subnode

On Thu, Jul 10, 2025 at 9:33 PM Greg KH <gregkh@...uxfoundation.org> wrote:
>
> On Mon, Jul 07, 2025 at 06:27:10PM +0800, Hsin-Te Yuan wrote:
> > After commit 725f31f300e3 ("thermal/of: support thermal zones w/o trips
> > subnode") was backported on 6.6 stable branch as commit d3304dbc2d5f
> > ("thermal/of: support thermal zones w/o trips subnode"), thermal zones
> > w/o trips subnode still fail to register since `mask` argument is not
> > set correctly. When number of trips subnode is 0, `mask` must be 0 to
> > pass the check in `thermal_zone_device_register_with_trips()`.
> >
> > Set `mask` to 0 when there's no trips subnode.
> >
> > Signed-off-by: Hsin-Te Yuan <yuanhsinte@...omium.org>
> > ---
> >  drivers/thermal/thermal_of.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
> > index 0f520cf923a1e684411a3077ad283551395eec11..97aeb869abf5179dfa512dd744725121ec7fd0d9 100644
> > --- a/drivers/thermal/thermal_of.c
> > +++ b/drivers/thermal/thermal_of.c
> > @@ -514,7 +514,7 @@ static struct thermal_zone_device *thermal_of_zone_register(struct device_node *
> >       of_ops->bind = thermal_of_bind;
> >       of_ops->unbind = thermal_of_unbind;
> >
> > -     mask = GENMASK_ULL((ntrips) - 1, 0);
> > +     mask = ntrips ? GENMASK_ULL((ntrips) - 1, 0) : 0;
>
> Meta-comment, I hate ? : lines in C, especially when they are not
> needed, like here.  Spell this out, with a real if statement please, so
> that we can read and easily understand what is going on.
>
I will change this in v2 if we end up going with this solution.

> That being said, I agree with Rafael, let's do whatever is in mainline
> instead.  Fix it the same way it was fixed there by backporting the
> relevant commits.
>
> thanks,
>
> greg k-h

`mask` is removed in 83c2d444ed9d ("thermal: of: Set
THERMAL_TRIP_FLAG_RW_TEMP directly"), which needs 5340f7647294
("thermal: core: Add flags to struct thermal_trip"). I think it's
beyond a fix to introduce this. Also, there were several conflicts
when I tried to cherry-pick 5340f7647294. Compared to a simple
solution like setting `mask` to 0, I don't think it's worthwhile and
safe to cherry-pick all the dependencies.

Regards,
Hsin-Te

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ