2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

dpif-netdev: Fix a zero-rate bug for meter

Open vSwitch daemon crashes (by receiving signal SIGFPE,
Arithmetic exception) when a controller tries to send
a meter-mod message with zero rate.

Signed-off-by: Ali Volkan ATLI <volkan.atli@argela.com.tr>
Signed-off-by: Andy Zhou <azhou@ovn.org>
This commit is contained in:
Ali Volkan ATLI
2017-09-27 18:33:57 +03:00
committed by Andy Zhou
parent 1193857813
commit 2029ce9ac3
2 changed files with 11 additions and 0 deletions

View File

@@ -4276,10 +4276,19 @@ dpif_netdev_meter_set(struct dpif *dpif, ofproto_meter_id *meter_id,
!(config->flags & (OFPMF13_KBPS | OFPMF13_PKTPS))) {
return EBADF; /* Unsupported flags set */
}
/* Validate bands */
if (config->n_bands == 0 || config->n_bands > MAX_BANDS) {
return EINVAL; /* Too many bands */
}
/* Validate rates */
for (i = 0; i < config->n_bands; i++) {
if (config->bands[i].rate == 0) {
return EBADRQC; /* rate must be non-zero */
}
}
for (i = 0; i < config->n_bands; ++i) {
switch (config->bands[i].type) {
case OFPMBT13_DROP: