Re: [PATCH 1/2] virtio-net: determine type of bufs correctly

2013-12-05 Thread Michael S. Tsirkin
On Thu, Dec 05, 2013 at 06:36:20PM +0400, Andrey Vagin wrote: > free_unused_bufs must check vi->mergeable_rx_bufs before > vi->big_packets, because we use this sequence in other places. > Otherwise we allocate buffer of one type, then free it as another > type. > > general protection fault: [

Re: [PATCH 0/2] virtio-net: Fix two bugs on unloading the module

2013-12-05 Thread Michael S. Tsirkin
On Thu, Dec 05, 2013 at 06:36:19PM +0400, Andrey Vagin wrote: > They can be easy to reproduce, if you try to unload virtio-net > > Andrey Vagin (2): > virtio-net: determine type of bufs correctly > virtio: delete napi objects from netdev before releasing memory Thanks a lot for the patches!

[PATCH 1/2] virtio-net: determine type of bufs correctly

2013-12-05 Thread Andrey Vagin
free_unused_bufs must check vi->mergeable_rx_bufs before vi->big_packets, because we use this sequence in other places. Otherwise we allocate buffer of one type, then free it as another type. general protection fault: [#1] SMP Dumping ftrace buffer: (ftrace buffer empty) Modules linked in:

[PATCH 2/2] virtio: delete napi structures from netdev before releasing memory

2013-12-05 Thread Andrey Vagin
free_netdev calls netif_napi_del too, but it's too late, because napi structures are placed on vi->rq. netif_napi_add() is called from virtnet_alloc_queues. general protection fault: [#1] SMP Dumping ftrace buffer: (ftrace buffer empty) Modules linked in: ip6table_filter ip6_tables iptable

[PATCH 0/2] virtio-net: Fix two bugs on unloading the module

2013-12-05 Thread Andrey Vagin
They can be easy to reproduce, if you try to unload virtio-net Andrey Vagin (2): virtio-net: determine type of bufs correctly virtio: delete napi objects from netdev before releasing memory drivers/net/virtio_net.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) Cc: Rusty R

Re: [PATCH 2/2] virtio: delete napi structures from netdev before releasing memory

2013-12-05 Thread Michael S. Tsirkin
On Thu, Dec 05, 2013 at 06:36:21PM +0400, Andrey Vagin wrote: > free_netdev calls netif_napi_del too, but it's too late, because napi > structures are placed on vi->rq. netif_napi_add() is called from > virtnet_alloc_queues. > > general protection fault: [#1] SMP > Dumping ftrace buffer: >

Re: [PATCH 1/2] virtio-net: determine type of bufs correctly

2013-12-05 Thread Michael Dalton
Thanks Andrey, great catch. I believe this issue occurs in one more place, when packets are dropped if they are too short. I will send out a patch momentarily to fix that additional case. Best, Mike ___ Virtualization mailing list Virtualization@lists.l

[PATCH] virtio-net: free bufs correctly on invalid packet length

2013-12-05 Thread Michael Dalton
When a packet with invalid length arrives, ensure that the packet is freed correctly if mergeable packet buffers and big packets (GUEST_TSO4) are both enabled. --- drivers/net/virtio_net.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/

Re: [PATCH] virtio-net: free bufs correctly on invalid packet length

2013-12-05 Thread Sergei Shtylyov
Hello. On 12/05/2013 11:16 PM, Michael Dalton wrote: When a packet with invalid length arrives, ensure that the packet is freed correctly if mergeable packet buffers and big packets (GUEST_TSO4) are both enabled. Looks like a similar patch have been posted by Andrey Vagin today. You also

Re: [PATCH] virtio-net: free bufs correctly on invalid packet length

2013-12-05 Thread Michael Dalton
Thanks Sergei, Yes this is a similar bugfix, the patch I saw from Andrey fixed this issue in free_unused_bufs. The problem also occurs when dropping a packet that is too short. Apologies for forgetting to sign off on the patch, I will re-send. Best, Mike

[PATCH v2] virtio-net: free bufs correctly on invalid packet length

2013-12-05 Thread Michael Dalton
When a packet with invalid length arrives, ensure that the packet is freed correctly if mergeable packet buffers and big packets (GUEST_TSO4) are both enabled. Signed-off-by: Michael Dalton --- drivers/net/virtio_net.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dri

Re: [PATCH v2] virtio-net: free bufs correctly on invalid packet length

2013-12-05 Thread Michael Dalton
Hi, A quick note on this patch: I have confirmed that without this patch a kernel crash occurs if we force a 'packet too short' error sufficiently many times. This patch eliminates the kernel crash. Since this crash would be triggered by a hypervisor bug, I made a small change not reflected in th

Re: [PATCH 1/2] virtio-net: determine type of bufs correctly

2013-12-05 Thread Jason Wang
On 12/05/2013 10:36 PM, Andrey Vagin wrote: > free_unused_bufs must check vi->mergeable_rx_bufs before > vi->big_packets, because we use this sequence in other places. > Otherwise we allocate buffer of one type, then free it as another > type. > > general protection fault: [#1] SMP > Dumping f

Re: [PATCH 2/2] virtio: delete napi structures from netdev before releasing memory

2013-12-05 Thread Jason Wang
On 12/05/2013 10:36 PM, Andrey Vagin wrote: > free_netdev calls netif_napi_del too, but it's too late, because napi > structures are placed on vi->rq. netif_napi_add() is called from > virtnet_alloc_queues. > > general protection fault: [#1] SMP > Dumping ftrace buffer: >(ftrace buffer emp

Re: [PATCH v2] virtio-net: free bufs correctly on invalid packet length

2013-12-05 Thread Jason Wang
On 12/06/2013 05:14 AM, Michael Dalton wrote: > When a packet with invalid length arrives, ensure that the packet > is freed correctly if mergeable packet buffers and big packets > (GUEST_TSO4) are both enabled. > > Signed-off-by: Michael Dalton > --- > drivers/net/virtio_net.c | 6 +++--- > 1 fi