[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <56a9253a801757c03320cfe0000c5ac68dacac14.camel@sipsolutions.net>
Date: Tue, 11 Feb 2025 14:29:11 +0100
From: Johannes Berg <johannes@...solutions.net>
To: Gavrilov Ilia <Ilia.Gavrilov@...otecs.ru>
Cc: Julan Hsu <julanhsu@...gle.com>, "linux-wireless@...r.kernel.org"
<linux-wireless@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "lvc-project@...uxtesting.org"
<lvc-project@...uxtesting.org>, "stable@...r.kernel.org"
<stable@...r.kernel.org>
Subject: Re: [PATCH v3] wifi: mac80211: fix integer overflow in
hwmp_route_info_get()
On Thu, 2025-01-16 at 08:49 +0000, Gavrilov Ilia wrote:
> Since the new_metric and last_hop_metric variables can reach
> the MAX_METRIC(0xffffffff) value, an integer overflow may occur
> when multiplying them by 10/9. It can lead to incorrect behavior.
>
> Found by InfoTeCS on behalf of Linux Verification Center
> (linuxtesting.org) with SVACE.
>
> Fixes: a8d418d9ac25 ("mac80211: mesh: only switch path when new metric is at least 10% better")
> Cc: stable@...r.kernel.org
Seems a bit overblown for stable, but also don't really care...
> +static inline bool is_metric_better(u32 x, u32 y, u32 percent)
> +{
You shouldn't put inline here, in general.
Also that function probably wants a comment, and the 'percent' argument
is hardcoded to 10, so you don't need it. Let's keep this stuff simple,
*especially* if it's for stable too ...
> + if (check_add_overflow(x, a, &e)) {
> + if (x > y - a)
> + return false;
seems simpler as "return x > y - a;" or so?
johannes
Powered by blists - more mailing lists