[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [UNIKRAFT PATCH 2/2] plat/virtio: Add error check for tag name
During virtio-9p configuration get we check for error while getting the tag length but not the tag. The patch adds this check Signed-off-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx> --- plat/drivers/virtio/virtio_9p.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/plat/drivers/virtio/virtio_9p.c b/plat/drivers/virtio/virtio_9p.c index 7bd99b8d..a783eba2 100644 --- a/plat/drivers/virtio/virtio_9p.c +++ b/plat/drivers/virtio/virtio_9p.c @@ -359,14 +359,23 @@ static int virtio_9p_feature_negotiate(struct virtio_9p_device *d) goto out; } - virtio_config_get(d->vdev, + + if (virtio_config_get(d->vdev, __offsetof(struct virtio_9p_config, tag), - d->tag, tag_len, 1); + d->tag, tag_len, 1) < 0) { + uk_pr_err(DRIVER_NAME": Failed to read the tag on the device %p\n", + d); + rc = -EAGAIN; + goto free_mem; + } d->tag[tag_len] = '\0'; d->vdev->features &= host_features; virtio_feature_set(d->vdev, d->vdev->features); + return 0; +free_mem: + uk_free(a, d->tag); out: return rc; } -- 2.20.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |