Skip to content

Commit

Permalink
vhost: reject zero size iova range
Browse files Browse the repository at this point in the history
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: [email protected]
Fixes: 6b1e6cc ("vhost: new device IOTLB API")
Signed-off-by: Jason Wang <[email protected]>
Acked-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
jasowang authored and davem330 committed Apr 11, 2019
1 parent b4f47f3 commit 813dbeb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/vhost/vhost.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 813dbeb

Please sign in to comment.