[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [External] [UNIKRAFT PATCH 2/2] plat/virtio: Add error check for tag name
- To: Sharan Santhanam <sharan.santhanam@xxxxxxxxx>
- From: "Jung, Alexander (Student)" <a.jung@xxxxxxxxxxxxxxx>
- Date: Fri, 8 Jan 2021 10:31:39 +0000
- Accept-language: en-GB, en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=lancaster.ac.uk; dmarc=pass action=none header.from=lancaster.ac.uk; dkim=pass header.d=lancaster.ac.uk; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6uHpnmj6QLUcRCtJaXH0FYiLGqgaYtF5ioIhio8UMj8=; b=Ve+MzrkOjkYXHW32wPT3hbIFgYwFqLPehNdTOz3UCHa4Ze5s7lvEMXlJ2NXIlH6+mJzUDjelSyiEaRRcOUsKpEZMtFHbWnsVjML4ESRtkM79fw5RdCg+Uiypb6J547X6qPacDqZYJkHaYpOgVv3BDBBLzJLq/KvrYo7S33O7BT5xvxYTuwH1hKmNEW4R1JvCn7LWHYvhmsxHFEdfDz0oZEj1Al/MHaJUm+ioZy+GqYFQDe1YeUADaf3eMQT2V10SevEvhEh2OjC2YpegBu/DnGojiMzv0QR0ObMyOa7hP/1opX1oD9diHQXv0mBtvAy6sD7g+HyUqL52FmLDIEkvNA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cvPz9JGf+Jrc6QK9+yvgJLN2+ADumOEL9zoGlASUE68bCcRyOWCafaKaiNk7BKhP9IYQvcG4/1yOznYdgP8rmRyOkGCVb/x8PMJB0wmeIAZ1HOvrkmOwZvvj5Gmh4BFJZ/Hbv8o9/rMFmMARndi91r+7U96LrBtfNom+SB7oCJ/zCW8BT6O4INCoCBdx68c/bjCMahG2j2jnxsaMpdxXIA/es552Yn1or4YLTWagE8kRWmJYX+n84TOLdyOYuD64OCtVGx8OmWwGDQakLzgyQpRjPKeGLK7hEyWdOXQMrVzRBVvg9QEZ5nUrIhAb9wtxC4gTq7m+KPdKbZywjk44hg==
- Authentication-results: neclab.eu; dkim=none (message not signed) header.d=none;neclab.eu; dmarc=none action=none header.from=lancaster.ac.uk;
- Cc: "minios-devel@xxxxxxxxxxxxx" <minios-devel@xxxxxxxxxxxxx>
- Delivery-date: Fri, 08 Jan 2021 10:31:47 +0000
- List-id: Mini-os development list <minios-devel.lists.xenproject.org>
- Thread-index: AQHW5aUptdhFQzJRTkWhSZjDDEbxcaodh5uA
- Thread-topic: [External] [UNIKRAFT PATCH 2/2] plat/virtio: Add error check for tag name
Reviewed-by: Alexander Jung <a.jung@xxxxxxxxxxx>
> On 8. Jan 2021, at 10:00, Sharan Santhanam <sharan.santhanam@xxxxxxxxx> wrote:
>
> This email originated outside the University. Check before clicking links or
> attachments.
>
> 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
>
>
|