[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 07/32] vhost-net: do not crash if backend is not p
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL v2 07/32] vhost-net: do not crash if backend is not present |
Date: |
Tue, 14 Jun 2016 22:59:42 +0300 |
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>
Tested-by: Yuanhan Liu <address@hidden>
Reviewed-by: Yuanhan Liu <address@hidden>
Reviewed-by: Victor Kaplansky <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <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);
}
--
MST
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [PULL v2 07/32] vhost-net: do not crash if backend is not present,
Michael S. Tsirkin <=