Skip to content

Commit

Permalink
vhost: check for vhost_ops before using.
Browse files Browse the repository at this point in the history
'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 <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
  • Loading branch information
igsilya authored and mstsirkin committed Aug 10, 2016
1 parent 53279c7 commit ca10203
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion hw/net/vhost_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit ca10203

Please sign in to comment.