Skip to content
Commit 5c011817 authored by Tao Liu's avatar Tao Liu Committed by Greg Kroah-Hartman
Browse files

openvswitch: meter: fix race when getting now_ms.

[ Upstream commit e4df1b0c ]

We have observed meters working unexpected if traffic is 3+Gbit/s
with multiple connections.

now_ms is not pretected by meter->lock, we may get a negative
long_delta_ms when another cpu updated meter->used, then:
    delta_ms = (u32)long_delta_ms;
which will be a large value.

    band->bucket += delta_ms * band->rate;
then we get a wrong band->bucket.

OpenVswitch userspace datapath has fixed the same issue[1] some
time ago, and we port the implementation to kernel datapath.

[1] https://patchwork.ozlabs.org/project/openvswitch/patch/20191025114436.9746-1-i.maximets@ovn.org/



Fixes: 96fbc13d ("openvswitch: Add meter infrastructure")
Signed-off-by: default avatarTao Liu <thomas.liu@ucloud.cn>
Suggested-by: default avatarIlya Maximets <i.maximets@ovn.org>
Reviewed-by: default avatarIlya Maximets <i.maximets@ovn.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 5bfdc481
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment