Commit ca10203c authored by Ilya Maximets's avatar Ilya Maximets Committed by Michael S. Tsirkin
Browse files

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: default avatarIlya Maximets <i.maximets@samsung.com>
Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent 53279c76
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);
    }