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: <911d6dda-85de-ba8d-0c84-6a37e91523de@cogentembedded.com>
Date:   Wed, 24 May 2017 12:41:15 +0300
From:   Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To:     "Jason A. Donenfeld" <Jason@...c4.com>, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, davem@...emloft.net
Cc:     "Michael S. Tsirkin" <mst@...hat.com>,
        Jason Wang <jasowang@...hat.com>
Subject: Re: [PATCH net-next v9 5/5] virtio_net: check return value of
 skb_to_sgvec always

Hello!

On 5/23/2017 7:05 PM, Jason A. Donenfeld wrote:

> Signed-off-by: Jason A. Donenfeld <Jason@...c4.com>
> Cc: "Michael S. Tsirkin" <mst@...hat.com>
> Cc: Jason Wang <jasowang@...hat.com>
> ---
>  drivers/net/virtio_net.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 9320d96a1632..13fbe4b349c2 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -1150,7 +1150,7 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb)
>  	struct virtio_net_hdr_mrg_rxbuf *hdr;
>  	const unsigned char *dest = ((struct ethhdr *)skb->data)->h_dest;
>  	struct virtnet_info *vi = sq->vq->vdev->priv;
> -	unsigned num_sg;
> +	int num_sg;
>  	unsigned hdr_len = vi->hdr_len;
>  	bool can_push;
>
> @@ -1177,11 +1177,16 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb)
>  	if (can_push) {
>  		__skb_push(skb, hdr_len);
>  		num_sg = skb_to_sgvec(skb, sq->sg, 0, skb->len);
> +                if (unlikely(num_sg < 0))

    Please indent with tabs, like above and below.

> +			return num_sg;
>  		/* Pull header back to avoid skew in tx bytes calculations. */
>  		__skb_pull(skb, hdr_len);
[...]

MBR, Sergei

Powered by blists - more mailing lists