vhost: reject zero size iova range
Subsystems (5)
PATCH 1/1 vhost: reject zero size iova range
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.
--- drivers/vhost/vhost.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/vhost/vhost.c +5 -1
@@ -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 ;
Signature · 1 line
2.19.1
Quoted 6 lines · Jason Wang
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 6b1e6cc7 ("vhost: new device IOTLB API")Signed-off-by Jason Wang <[email protected]>
Seems appropriate for stable.
Quoted 24 lines
--- drivers/vhost/vhost.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/vhost/vhost.c +5
-1@@ -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 ;Signature · 1 line
2.19.1
Quoted 6 lines · Jason Wang
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 6b1e6cc7 ("vhost: new device IOTLB API")Signed-off-by Jason Wang <[email protected]>
Seems appropriate for stable.
Quoted 24 lines
--- drivers/vhost/vhost.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/vhost/vhost.c +5
-1@@ -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 ;Signature · 1 line
2.19.1
David Miller
maintainerFrom: Jason Wang <[email protected]>
Date: Tue, 9 Apr 2019 12:10:25 +0800
Quoted 6 lines
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 6b1e6cc7 ("vhost: new device IOTLB API")Signed-off-by Jason Wang <[email protected]>
Applied and queued up for -stable.
David Miller
maintainerFrom: Jason Wang <[email protected]>
Date: Tue, 9 Apr 2019 12:10:25 +0800
Quoted 6 lines
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 6b1e6cc7 ("vhost: new device IOTLB API")Signed-off-by Jason Wang <[email protected]>
Applied and queued up for -stable.