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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iLviB6PVFw-KH1nD5uTdFWPXALpk05exH0+_iiqe2YE4Q@mail.gmail.com>
Date: Mon, 19 Jan 2026 19:30:17 +0100
From: Eric Dumazet <edumazet@...gle.com>
To: David Yang <mmyangfl@...il.com>
Cc: netdev@...r.kernel.org, Aaron Conole <aconole@...hat.com>, 
	Eelco Chaudron <echaudro@...hat.com>, Ilya Maximets <i.maximets@....org>, 
	"David S. Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, 
	Simon Horman <horms@...nel.org>, wangchuanlei <wangchuanlei@...pur.com>, dev@...nvswitch.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH net] net: openvswitch: fix data race in ovs_vport_get_upcall_stats

On Mon, Jan 19, 2026 at 7:14 PM David Yang <mmyangfl@...il.com> wrote:
>
> In ovs_vport_get_upcall_stats(), some statistics protected by
> u64_stats_sync, are read and accumulated in ignorance of possible
> u64_stats_fetch_retry() events. These statistics are already accumulated
> by u64_stats_inc(). Fix this by reading them into temporary variables
> first.
>
> Fixes: 1933ea365aa7 ("net: openvswitch: Add support to count upcall packets")
> Signed-off-by: David Yang <mmyangfl@...il.com>
> ---
>  net/openvswitch/vport.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
> index 6bbbc16ab778..bc46d661b527 100644
> --- a/net/openvswitch/vport.c
> +++ b/net/openvswitch/vport.c
> @@ -319,13 +319,17 @@ int ovs_vport_get_upcall_stats(struct vport *vport, struct sk_buff *skb)
>         for_each_possible_cpu(i) {
>                 const struct vport_upcall_stats_percpu *stats;
>                 unsigned int start;
> +               __u64 n_success;
> +               __u64 n_fail;

Please use u64

New __u64 only makes sense in include/uapi/

Feel free to change existing variables for consistency in your V2
patch (please wait ~24 hours before sending it)

diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
index 6bbbc16ab7780840c0f0d18f629b4747efe8f0e4..1c51f1fe0810976bbeece229be4370cad9a31c1c
100644
--- a/net/openvswitch/vport.c
+++ b/net/openvswitch/vport.c
@@ -310,12 +310,10 @@ void ovs_vport_get_stats(struct vport *vport,
struct ovs_vport_stats *stats)
  */
 int ovs_vport_get_upcall_stats(struct vport *vport, struct sk_buff *skb)
 {
+       u64 tx_success = 0, tx_fail = 0;
        struct nlattr *nla;
        int i;

-       __u64 tx_success = 0;
-       __u64 tx_fail = 0;
-
        for_each_possible_cpu(i) {
                const struct vport_upcall_stats_percpu *stats;
                unsigned int start;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ