net/virtio-user: ignore result if status is unsupported
authorAdrian Moreno <amorenoz@redhat.com>
Mon, 26 Oct 2020 16:39:27 +0000 (17:39 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 3 Nov 2020 22:35:05 +0000 (23:35 +0100)
commit5043a0608da1f4774465298a39ced350b151d80c
tree9dc5583a340894aaad9a9ae94316a2af1fe87c1c
parent0fa6d4c406892efa58a656ea0860f8422c3bf0e2
net/virtio-user: ignore result if status is unsupported

GET/SET STATUS is an optional feature, so it may not be negotiated. In
that case, the VIRTIO_GET_STATUS call will not update the status (given
as a pointer argument). Failing to identify this case would lead to
undefined behavior as the device status will be updated with the value
of a stack-allocated variable.

To fix this, return ENOTSUP if the feature is not supported and, in that
case, don't update device status.

Fixes: 44102e6298e7 ("net/virtio: check protocol feature in user backend")
Cc stable@dpdk.org

Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
drivers/net/virtio/virtio_user/vhost_user.c
drivers/net/virtio/virtio_user/virtio_user_dev.c