[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 13/18] vhost-net: do not crash if backend is not pre
From: |
marcandre . lureau |
Subject: |
[Qemu-devel] [PATCH 13/18] vhost-net: do not crash if backend is not present |
Date: |
Fri, 1 Apr 2016 13:16:23 +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 1e4710d..6c40c4e 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -415,8 +415,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.5.5
- Re: [Qemu-devel] [PATCH 10/18] vhost-user: add slave-fd support, (continued)
[Qemu-devel] [PATCH 12/18] vhost-user: disconnect on start failure, marcandre . lureau, 2016/04/01
[Qemu-devel] [PATCH 15/18] vhost-net: save & restore vring enable state, marcandre . lureau, 2016/04/01
[Qemu-devel] [PATCH 14/18] vhost-net: save & restore vhost-user acked features, marcandre . lureau, 2016/04/01
[Qemu-devel] [PATCH 13/18] vhost-net: do not crash if backend is not present,
marcandre . lureau <=
[Qemu-devel] [PATCH 16/18] test: vubr check vring enable state, marcandre . lureau, 2016/04/01
[Qemu-devel] [PATCH 18/18] test: add shutdown support vubr test, marcandre . lureau, 2016/04/01
[Qemu-devel] [PATCH 17/18] test: start vhost-user reconnect test, marcandre . lureau, 2016/04/01