[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 06/10] vhost-net: do not crash if backend is not pre
From: |
marcandre . lureau |
Subject: |
[Qemu-devel] [PATCH 06/10] vhost-net: do not crash if backend is not present |
Date: |
Tue, 10 May 2016 18:03:56 +0200 |
From: Marc-André Lureau <address@hidden>
Do not crash when backend is not present while enabling the ring. A
following patch will save the enabled state so it can be restored once
the backend is started.
Signed-off-by: Marc-André Lureau <address@hidden>
---
hw/net/vhost_net.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 6e1032f..805a0df 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -401,8 +401,13 @@ VHostNetState *get_vhost_net(NetClientState *nc)
int vhost_set_vring_enable(NetClientState *nc, int enable)
{
VHostNetState *net = get_vhost_net(nc);
- const VhostOps *vhost_ops = net->dev.vhost_ops;
+ const VhostOps *vhost_ops;
+
+ if (!net) {
+ return 0;
+ }
+ vhost_ops = net->dev.vhost_ops;
if (vhost_ops->vhost_set_vring_enable) {
return vhost_ops->vhost_set_vring_enable(&net->dev, enable);
}
--
2.7.4
- [Qemu-devel] [PATCH 00/10] RFCv3: vhost-user: simple reconnection support, marcandre . lureau, 2016/05/10
- [Qemu-devel] [PATCH 01/10] vhost-user: add ability to know vhost-user backend disconnection, marcandre . lureau, 2016/05/10
- [Qemu-devel] [PATCH 03/10] vubr: workaround stale vring base, marcandre . lureau, 2016/05/10
- [Qemu-devel] [PATCH 02/10] vubr: add client mode, marcandre . lureau, 2016/05/10
- [Qemu-devel] [PATCH 04/10] qemu-char: add qemu_chr_disconnect to close a fd accepted by listen fd, marcandre . lureau, 2016/05/10
- [Qemu-devel] [PATCH 09/10] tests: append i386 tests, marcandre . lureau, 2016/05/10
- [Qemu-devel] [PATCH 05/10] vhost-user: disconnect on start failure, marcandre . lureau, 2016/05/10
- [Qemu-devel] [PATCH 06/10] vhost-net: do not crash if backend is not present,
marcandre . lureau <=
- [Qemu-devel] [PATCH 08/10] vhost-net: save & restore vring enable state, marcandre . lureau, 2016/05/10
- [Qemu-devel] [PATCH 07/10] vhost-net: save & restore vhost-user acked features, marcandre . lureau, 2016/05/10
- [Qemu-devel] [PATCH 10/10] test: start vhost-user reconnect test, marcandre . lureau, 2016/05/10
- Re: [Qemu-devel] [PATCH 00/10] RFCv3: vhost-user: simple reconnection support, Michael S. Tsirkin, 2016/05/10
Re: [Qemu-devel] [PATCH 00/10] RFCv3: vhost-user: simple reconnection support, Yuanhan Liu, 2016/05/10