Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b82df420 authored by Jason Wang's avatar Jason Wang Committed by Greg Kroah-Hartman
Browse files

vhost: reject zero size iova range



[ Upstream commit 813dbeb656d6c90266f251d8bd2b02d445afa63f ]

We used to accept zero size iova range which will lead a infinite loop
in translate_desc(). Fixing this by failing the request in this case.

Reported-by: default avatar <syzbot+d21e6e297322a900c128@syzkaller.appspotmail.com>
Fixes: 6b1e6cc7 ("vhost: new device IOTLB API")
Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 242e5746
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -911,8 +911,12 @@ static int vhost_new_umem_range(struct vhost_umem *umem,
				u64 start, u64 size, u64 end,
				u64 userspace_addr, int perm)
{
	struct vhost_umem_node *tmp, *node = kmalloc(sizeof(*node), GFP_ATOMIC);
	struct vhost_umem_node *tmp, *node;

	if (!size)
		return -EFAULT;

	node = kmalloc(sizeof(*node), GFP_ATOMIC);
	if (!node)
		return -ENOMEM;