summaryrefslogtreecommitdiffstats
path: root/net/openvswitch/meter.c
diff options
context:
space:
mode:
authorJani Nikula <jani.nikula@intel.com>2021-07-01 17:46:34 +0200
committerJani Nikula <jani.nikula@intel.com>2021-07-01 17:46:34 +0200
commite42c6c1bc8d5e70d7b2c8af534b0d33a2be48f0c (patch)
tree4b1109adc051c943ef3edd990f5a907a0836bdf8 /net/openvswitch/meter.c
parentdrm/i915/display: Fix state mismatch in drm infoframe (diff)
parentMerge tag 'drm-intel-next-fixes-2021-06-29' of git://anongit.freedesktop.org/... (diff)
downloadlinux-e42c6c1bc8d5e70d7b2c8af534b0d33a2be48f0c.tar.xz
linux-e42c6c1bc8d5e70d7b2c8af534b0d33a2be48f0c.zip
Merge drm/drm-next into drm-intel-next
Bring drm-intel-next closer to drm-next and drm-intel-gt-next for a more feasible baseline for topic branches. Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Diffstat (limited to 'net/openvswitch/meter.c')
-rw-r--r--net/openvswitch/meter.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/net/openvswitch/meter.c b/net/openvswitch/meter.c
index 96b524ceabca..896b8f5bc885 100644
--- a/net/openvswitch/meter.c
+++ b/net/openvswitch/meter.c
@@ -611,6 +611,14 @@ bool ovs_meter_execute(struct datapath *dp, struct sk_buff *skb,
spin_lock(&meter->lock);
long_delta_ms = (now_ms - meter->used); /* ms */
+ if (long_delta_ms < 0) {
+ /* This condition means that we have several threads fighting
+ * for a meter lock, and the one who received the packets a
+ * bit later wins. Assuming that all racing threads received
+ * packets at the same time to avoid overflow.
+ */
+ long_delta_ms = 0;
+ }
/* Make sure delta_ms will not be too large, so that bucket will not
* wrap around below.