diff mbox

vhost_net: initialize acked_features to a safe value during ack

Message ID 1409734200-6725-1-git-send-email-mst@redhat.com
State New
Headers show

Commit Message

Michael S. Tsirkin Sept. 3, 2014, 8:50 a.m. UTC
commit 2e6d46d77ed328d34a94688da8371bcbe243479b (vhost: add
vhost_get_features and vhost_ack_features) removes the step that
initializes the acked_features to backend_features.

As this field is now uninitialized, vhost initialization will sometimes
fail.

To fix, initialize field in core vhost code.

As the next step, cleanup vhost scsi code as well.

Reported-by: Jason Wang <jasowang@redhat.com>
Reported-by: Andrey Korolyov <andrey@xdel.ru>
Cc: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/net/vhost_net.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Michael S. Tsirkin Sept. 3, 2014, 8:54 a.m. UTC | #1
On Wed, Sep 03, 2014 at 11:50:05AM +0300, Michael S. Tsirkin wrote:
> commit 2e6d46d77ed328d34a94688da8371bcbe243479b (vhost: add
> vhost_get_features and vhost_ack_features) removes the step that
> initializes the acked_features to backend_features.
> 
> As this field is now uninitialized, vhost initialization will sometimes
> fail.
> 
> To fix, initialize field in core vhost code.
> 
> As the next step, cleanup vhost scsi code as well.
> 
> Reported-by: Jason Wang <jasowang@redhat.com>
> Reported-by: Andrey Korolyov <andrey@xdel.ru>
> Cc: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


Oops, it's the wrong patch - original one from jason :(
Sorry, resending.

> ---
>  hw/net/vhost_net.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> index 1fe18c7..e258fda 100644
> --- a/hw/net/vhost_net.c
> +++ b/hw/net/vhost_net.c
> @@ -115,6 +115,7 @@ unsigned vhost_net_get_features(struct vhost_net *net, unsigned features)
>  
>  void vhost_net_ack_features(struct vhost_net *net, unsigned features)
>  {
> +    net->dev.acked_features = net->dev.backend_features;
>      vhost_ack_features(&net->dev, vhost_net_get_feature_bits(net), features);
>  }
>  
> -- 
> MST
diff mbox

Patch

diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 1fe18c7..e258fda 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -115,6 +115,7 @@  unsigned vhost_net_get_features(struct vhost_net *net, unsigned features)
 
 void vhost_net_ack_features(struct vhost_net *net, unsigned features)
 {
+    net->dev.acked_features = net->dev.backend_features;
     vhost_ack_features(&net->dev, vhost_net_get_feature_bits(net), features);
 }