[ovs-dev] [PATCH 1/1] ofp-parse: Fix segfault due to bad meter n_bands

Flavio Fernandes flavio at flaviof.com
Tue Mar 16 20:24:17 UTC 2021


Meter commands internally use ofctl_meter_mod__ and ofctl_meter_request__ functions,
which have an optional parameter called str. When str is NULL, these 2 functions initialize
a struct with meter bands set as NULL. It also needs to set meter n_bands to 0.

Fixes: 3200ed5805 ("ovs-ofctl: Add meter support.")
Signed-off-by: Flavio Fernandes <flavio at flaviof.com>
---
 utilities/ovs-ofctl.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
index 3601890f4..bd1ba9222 100644
--- a/utilities/ovs-ofctl.c
+++ b/utilities/ovs-ofctl.c
@@ -4030,6 +4030,8 @@ ofctl_meter_mod__(const char *bridge, const char *str, int command)
         usable_protocols = OFPUTIL_P_OF13_UP;
         mm.command = command;
         mm.meter.meter_id = OFPM13_ALL;
+        mm.meter.flags = 0;
+        mm.meter.n_bands = 0;
         mm.meter.bands = NULL;
     }
 
@@ -4059,6 +4061,8 @@ ofctl_meter_request__(const char *bridge, const char *str,
     } else {
         usable_protocols = OFPUTIL_P_OF13_UP;
         mm.meter.meter_id = OFPM13_ALL;
+        mm.meter.flags = 0;
+        mm.meter.n_bands = 0;
         mm.meter.bands = NULL;
     }
 
-- 
2.25.1



More information about the dev mailing list