vhost: do not get config notifier when one doesn't exist
PATCH 1/1 vhost: do not get config notifier when one doesn't exist
Commit e3b12d0c55e4 ("util/event_notifier: more strict API") added an assert for an uninitialized file descriptor in event_notifier_get_fd(), but it presumes that such a thing always exists.
Since it's only vhost_ops->vhost_set_config_call that expects to use this file descriptor, move the retrieval of that fd inside the non-null check to avoid an assertion failure when it does not exist.
--- hw/virtio/vhost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/vhost.c +1 -1
@@ -2119,8 +2119,8 @@ static void vhost_start_config_intr(struct vhost_dev *dev)virtio_config_get_guest_notifier (dev->vdev);assert (dev->vhost_ops); -int fd =event_notifier_get_fd (config_notifier);if (dev->vhost_ops->vhost_set_config_call) { +int fd =event_notifier_get_fd (config_notifier); r = dev->vhost_ops->vhost_set_config_call (dev, fd);if (!r) {event_notifier_set (config_notifier);
Signature · 1 line
2.53.0
Quoted 10 lines · Eric Farman
Commit
e3b12d0c55e4("util/event_notifier: more strict API") added an assert for an uninitialized file descriptor inevent_notifier_get_fd(), but it presumes that such a thing always exists.Since it's only
vhost_ops->vhost_set_config_callthat expects to use this file descriptor, move the retrieval of that fd inside the non-null check to avoid an assertion failure when it does not exist.Fixes e3b12d0c55e4 ("util/event_notifier: more strict API")Signed-off-by Eric Farman <[email protected]>
Ah, this is not going to work. VDPA has previously worked on s390x, but as it's the only place that sets vhost_ops->vhost_set_config_call we'll still end up failing the assertion in event_notifier_get_fd for that device type.
Quoted 18 lines
--- hw/virtio/vhost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/virtio/vhost.c +1
-1@@ -2119,8 +2119,8 @@ static void vhost_start_config_intr(struct vhost_dev *dev)virtio_config_get_guest_notifier (dev->vdev);assert (dev->vhost_ops); -int fd =event_notifier_get_fd (config_notifier);if (dev->vhost_ops->vhost_set_config_call) { +int fd =event_notifier_get_fd (config_notifier); r = dev->vhost_ops->vhost_set_config_call (dev, fd);if (!r) {event_notifier_set (config_notifier);