[v2,2/2] net/virtio: fix notification area initialization
Checks
Commit Message
Notification area is a Virtio feature that requires to be
negotiated because not all devices support it. Currently,
it is tried to be initialized as soon as the backend
implements the callback, so it assumes all Vhost-vDPA
devices support it.
This patch skips calling the notification area map callback
if the device does not advertise its support.
Fixes: 0fd2782660c8 ("net/virtio-user: support notification area mapping")
Reviewed-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
drivers/net/virtio/virtio_user/virtio_user_dev.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
@@ -445,8 +445,9 @@ virtio_user_dev_init_notify(struct virtio_user_dev *dev)
dev->kickfds[i] = kickfd;
}
- if (dev->ops->map_notification_area)
- if (dev->ops->map_notification_area(dev))
+ if (dev->device_features & (1ULL << VIRTIO_F_NOTIFICATION_DATA))
+ if (dev->ops->map_notification_area &&
+ dev->ops->map_notification_area(dev))
goto err;
return 0;