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>] [day] [month] [year] [list]
Message-ID: <20250421212838.1117423-1-d.kandybka@gmail.com>
Date: Tue, 22 Apr 2025 00:28:34 +0300
From: Dmitry Kandybka <d.kandybka@...il.com>
To: Aaron Conole <aconole@...hat.com>
Cc: Eelco Chaudron <echaudro@...hat.com>,
	Ilya Maximets <i.maximets@....org>,
	dev@...nvswitch.org,
	netdev@...r.kernel.org,
	lvc-project@...uxtesting.org
Subject: [PATCH] openvswitch: fix band bucket value computation in ovs_meter_execute()

In ovs_meter_execute(), promote 'delta_ms' to 'long long int' to avoid
possible integer overflow. It's assumed that'delta_ms' and 'band->rate'
multiplication leads to overcomming UINT32_MAX.
Compile tested only.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Dmitry Kandybka <d.kandybka@...il.com>
---
 net/openvswitch/meter.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/openvswitch/meter.c b/net/openvswitch/meter.c
index cc08e0403909..2fab53ac60a8 100644
--- a/net/openvswitch/meter.c
+++ b/net/openvswitch/meter.c
@@ -594,11 +594,11 @@ bool ovs_meter_execute(struct datapath *dp, struct sk_buff *skb,
 {
 	long long int now_ms = div_u64(ktime_get_ns(), 1000 * 1000);
 	long long int long_delta_ms;
+	long long int delta_ms;
 	struct dp_meter_band *band;
 	struct dp_meter *meter;
 	int i, band_exceeded_max = -1;
 	u32 band_exceeded_rate = 0;
-	u32 delta_ms;
 	u32 cost;
 
 	meter = lookup_meter(&dp->meter_tbl, meter_id);
@@ -623,7 +623,7 @@ bool ovs_meter_execute(struct datapath *dp, struct sk_buff *skb,
 	 * wrap around below.
 	 */
 	delta_ms = (long_delta_ms > (long long int)meter->max_delta_t)
-		   ? meter->max_delta_t : (u32)long_delta_ms;
+		   ? meter->max_delta_t : long_delta_ms;
 
 	/* Update meter statistics.
 	 */
-- 
2.43.5


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ