summaryrefslogtreecommitdiff
path: root/hw/net
diff options
context:
space:
mode:
authorIlya Maximets <i.maximets@samsung.com>2016-08-03 08:22:49 +0300
committerMichael S. Tsirkin <mst@redhat.com>2016-08-10 17:47:29 +0300
commitca10203cde7cf37623e0e77da1696ba1fbce5d84 (patch)
tree24f87d97a7b5525d6be64260b0e605a7c1d94bb2 /hw/net
parent53279c76cf071fed07a336948d37c72e3613e0b7 (diff)
downloadqemu-ca10203cde7cf37623e0e77da1696ba1fbce5d84.zip
vhost: check for vhost_ops before using.
'vhost_set_vring_enable()' tries to call function using pointer to 'vhost_ops' which can be already zeroized in 'vhost_dev_cleanup()' while vhost disconnection. Fix that by checking 'vhost_ops' before using. This fixes QEMU crash on calling 'ethtool -L eth0 combined 2' if vhost disconnected. Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/net')
-rw-r--r--hw/net/vhost_net.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index dc61dc1c5f..f2d49ad7e7 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -428,7 +428,7 @@ int vhost_set_vring_enable(NetClientState *nc, int enable)
nc->vring_enable = enable;
- if (vhost_ops->vhost_set_vring_enable) {
+ if (vhost_ops && vhost_ops->vhost_set_vring_enable) {
return vhost_ops->vhost_set_vring_enable(&net->dev, enable);
}