Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1611891 > unrolled thread

[PATCH] virtio_net: fix mergeable bufs error handling

Started by"Michael S. Tsirkin" <mst@redhat.com>
First post2017-03-29 14:40 +0200
Last post2017-03-30 20:00 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] virtio_net: fix mergeable bufs error handling "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-29 14:40 +0200
    Re: [PATCH] virtio_net: fix mergeable bufs error handling Jason Wang <jasowang@redhat.com> - 2017-03-30 06:00 +0200
    Re: [PATCH] virtio_net: fix mergeable bufs error handling David Miller <davem@davemloft.net> - 2017-03-30 20:00 +0200

#1611891 — [PATCH] virtio_net: fix mergeable bufs error handling

From"Michael S. Tsirkin" <mst@redhat.com>
Date2017-03-29 14:40 +0200
Subject[PATCH] virtio_net: fix mergeable bufs error handling
Message-ID<tql3j-6Rq-13@gated-at.bofh.it>
On xdp error we try to free head_skb without having
initialized it, that's clearly bogus.

Fixes: f600b6905015 ("virtio_net: Add XDP support")
Cc: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 drivers/net/virtio_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 11773d6..e0fb3707 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -570,7 +570,7 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
 	u16 num_buf;
 	struct page *page;
 	int offset;
-	struct sk_buff *head_skb, *curr_skb;
+	struct sk_buff *head_skb = NULL, *curr_skb;
 	struct bpf_prog *xdp_prog;
 	unsigned int truesize;
 
-- 
MST

[toc] | [next] | [standalone]


#1612542

FromJason Wang <jasowang@redhat.com>
Date2017-03-30 06:00 +0200
Message-ID<tqzpD-fK-9@gated-at.bofh.it>
In reply to#1611891

On 2017年03月29日 20:37, Michael S. Tsirkin wrote:
> On xdp error we try to free head_skb without having
> initialized it, that's clearly bogus.
>
> Fixes: f600b6905015 ("virtio_net: Add XDP support")
> Cc: John Fastabend <john.fastabend@gmail.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>   drivers/net/virtio_net.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 11773d6..e0fb3707 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -570,7 +570,7 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
>   	u16 num_buf;
>   	struct page *page;
>   	int offset;
> -	struct sk_buff *head_skb, *curr_skb;
> +	struct sk_buff *head_skb = NULL, *curr_skb;
>   	struct bpf_prog *xdp_prog;
>   	unsigned int truesize;
>   

My tree (net.git HEAD is 8f1f7eeb22c16a197159cf7b35d1350695193ead) has:

     head_skb = NULL;

just after the above codes.

Thanks

[toc] | [prev] | [next] | [standalone]


#1613334

FromDavid Miller <davem@davemloft.net>
Date2017-03-30 20:00 +0200
Message-ID<tqMwx-1vj-11@gated-at.bofh.it>
In reply to#1611891
From: "Michael S. Tsirkin" <mst@redhat.com>
Date: Wed, 29 Mar 2017 15:37:37 +0300

> @@ -570,7 +570,7 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
>  	u16 num_buf;
>  	struct page *page;
>  	int offset;
> -	struct sk_buff *head_skb, *curr_skb;
> +	struct sk_buff *head_skb = NULL, *curr_skb;
>  	struct bpf_prog *xdp_prog;
>  	unsigned int truesize;
>  

Like Jason, I see the very next line is:

	head_skb = NULL;

so I don't think this is necessary.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web