qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] tap: clear vhost_net backend on cleanup
@ 2010-10-27 18:03 Michael S. Tsirkin
  2010-10-28  7:40 ` Jason Wang
  0 siblings, 1 reply; 2+ messages in thread
From: Michael S. Tsirkin @ 2010-10-27 18:03 UTC (permalink / raw)
  To: Jason Wang; +Cc: qemu-devel

Frontends calling tap_get_vhost_net get an invalid pointer after the
peer backend has been deleted. Jason Wang <jasowang@redhat.com> reports
this leading to a crash in ack_features when we remove the vhost-net
bakend of a virtio nic.

The fix is simply to clear the backend pointer.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---

Jason, could you please confirm whether this patch
will fix the issue you have observed?

Thanks,

 net/tap.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/net/tap.c b/net/tap.c
index 0147dab..4cfa538 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -258,6 +258,7 @@ static void tap_cleanup(VLANClientState *nc)
 
     if (s->vhost_net) {
         vhost_net_cleanup(s->vhost_net);
+        s->vhost_net = NULL;
     }
 
     qemu_purge_queued_packets(nc);
-- 
1.7.3.2.91.g446ac

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

* [Qemu-devel] [PATCH] tap: clear vhost_net backend on cleanup
  2010-10-27 18:03 [Qemu-devel] [PATCH] tap: clear vhost_net backend on cleanup Michael S. Tsirkin
@ 2010-10-28  7:40 ` Jason Wang
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Wang @ 2010-10-28  7:40 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: Jason Wang, qemu-devel

Michael S. Tsirkin writes:
 > Frontends calling tap_get_vhost_net get an invalid pointer after the
 > peer backend has been deleted. Jason Wang <jasowang@redhat.com> reports
 > this leading to a crash in ack_features when we remove the vhost-net
 > bakend of a virtio nic.
 > 
 > The fix is simply to clear the backend pointer.
 > 
 > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
 > ---
 > 
 > Jason, could you please confirm whether this patch
 > will fix the issue you have observed?
 > 
 > Thanks,
 > 

Yes it does, and how about also add assign fd to -1 in tap_cleanup()
and then check it in virtio_net_set_features() otherwise we could get
warning of the failure of offload setting?

 >  net/tap.c |    1 +
 >  1 files changed, 1 insertions(+), 0 deletions(-)
 > 
 > diff --git a/net/tap.c b/net/tap.c
 > index 0147dab..4cfa538 100644
 > --- a/net/tap.c
 > +++ b/net/tap.c
 > @@ -258,6 +258,7 @@ static void tap_cleanup(VLANClientState *nc)
 >  
 >      if (s->vhost_net) {
 >          vhost_net_cleanup(s->vhost_net);
 > +        s->vhost_net = NULL;
 >      }
 >  
 >      qemu_purge_queued_packets(nc);
 > -- 
 > 1.7.3.2.91.g446ac

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

end of thread, other threads:[~2010-10-28  7:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-27 18:03 [Qemu-devel] [PATCH] tap: clear vhost_net backend on cleanup Michael S. Tsirkin
2010-10-28  7:40 ` Jason Wang

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).