linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] virtio_net: fix mergeable bufs error handling
@ 2017-03-29 12:37 Michael S. Tsirkin
  2017-03-30  3:59 ` Jason Wang
  2017-03-30 17:57 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2017-03-29 12:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: John Fastabend, Jason Wang, virtualization, netdev

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] virtio_net: fix mergeable bufs error handling
  2017-03-29 12:37 [PATCH] virtio_net: fix mergeable bufs error handling Michael S. Tsirkin
@ 2017-03-30  3:59 ` Jason Wang
  2017-03-30 17:57 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Wang @ 2017-03-30  3:59 UTC (permalink / raw)
  To: Michael S. Tsirkin, linux-kernel; +Cc: John Fastabend, virtualization, netdev



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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] virtio_net: fix mergeable bufs error handling
  2017-03-29 12:37 [PATCH] virtio_net: fix mergeable bufs error handling Michael S. Tsirkin
  2017-03-30  3:59 ` Jason Wang
@ 2017-03-30 17:57 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-03-30 17:57 UTC (permalink / raw)
  To: mst; +Cc: linux-kernel, john.fastabend, jasowang, virtualization, netdev

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-30 17:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-29 12:37 [PATCH] virtio_net: fix mergeable bufs error handling Michael S. Tsirkin
2017-03-30  3:59 ` Jason Wang
2017-03-30 17:57 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).