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]
Date:   Thu, 16 Dec 2021 01:31:03 -0500
From:   "Michael S. Tsirkin" <mst@...hat.com>
To:     Wenliang Wang <wangwenliang.1995@...edance.com>
Cc:     jasowang@...hat.com, davem@...emloft.net, kuba@...nel.org,
        virtualization@...ts.linux-foundation.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] virtio_net: fix rx_drops stat for small pkts

On Thu, Dec 16, 2021 at 11:11:35AM +0800, Wenliang Wang wrote:
> We found the stat of rx drops for small pkts does not increment when
> build_skb fail, it's not coherent with other mode's rx drops stat.
> 
> Signed-off-by: Wenliang Wang <wangwenliang.1995@...edance.com>

Acked-by: Michael S. Tsirkin <mst@...hat.com>

> ---
>  drivers/net/virtio_net.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 55db6a336f7e..b107835242ad 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -733,7 +733,7 @@ static struct sk_buff *receive_small(struct net_device *dev,
>  		pr_debug("%s: rx error: len %u exceeds max size %d\n",
>  			 dev->name, len, GOOD_PACKET_LEN);
>  		dev->stats.rx_length_errors++;
> -		goto err_len;
> +		goto err;
>  	}
>  
>  	if (likely(!vi->xdp_enabled)) {
> @@ -825,10 +825,8 @@ static struct sk_buff *receive_small(struct net_device *dev,
>  
>  skip_xdp:
>  	skb = build_skb(buf, buflen);
> -	if (!skb) {
> -		put_page(page);
> +	if (!skb)
>  		goto err;
> -	}
>  	skb_reserve(skb, headroom - delta);
>  	skb_put(skb, len);
>  	if (!xdp_prog) {
> @@ -839,13 +837,12 @@ static struct sk_buff *receive_small(struct net_device *dev,
>  	if (metasize)
>  		skb_metadata_set(skb, metasize);
>  
> -err:
>  	return skb;
>  
>  err_xdp:
>  	rcu_read_unlock();
>  	stats->xdp_drops++;
> -err_len:
> +err:
>  	stats->drops++;
>  	put_page(page);
>  xdp_xmit:
> -- 
> 2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ