vhost_net: initialize acked_features to a safe value during ack
PATCH 1/1 vhost_net: initialize acked_features to a safe value during ack
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.
--- hw/net/vhost_net.c | 1 + 1 file changed, 1 insertion(+)
hw/net/vhost_net.c +1 -0
@@ -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); }
Signature · 1 line
MST
Quoted 11 lines · Michael S. Tsirkin
commit
2e6d46d77ed328d34a94688da8371bcbe243479b(vhost: addvhost_get_featuresandvhost_ack_features) removes the step that initializes theacked_featurestobackend_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.
Quoted 7 lines
Reported-by Jason Wang <[email protected]>Reported-by Andrey Korolyov <[email protected]>Cc Nikolay Nikolaev <[email protected]>Signed-off-by Jason Wang <[email protected]>Reviewed-by Michael S. Tsirkin <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>
Oops, it's the wrong patch - original one from jason :( Sorry, resending.
Quoted 18 lines
--- hw/net/vhost_net.c | 1 + 1 file changed, 1 insertion(+)hw/net/vhost_net.c +1
-0@@ -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); }Signature · 1 line
MST