* [PATCH net] vhost: reject zero size iova range
@ 2019-04-09 4:10 Jason Wang
2019-04-09 12:50 ` Michael S. Tsirkin
2019-04-11 5:46 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Jason Wang @ 2019-04-09 4:10 UTC (permalink / raw)
To: mst, jasowang, kvm, virtualization, netdev, linux-kernel
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: syzbot+d21e6e297322a900c128@syzkaller.appspotmail.com
Fixes: 6b1e6cc7 ("vhost: new device IOTLB API")
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/vhost/vhost.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 5ace833de746..351af88231ad 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -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;
--
2.19.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] vhost: reject zero size iova range
2019-04-09 4:10 [PATCH net] vhost: reject zero size iova range Jason Wang
@ 2019-04-09 12:50 ` Michael S. Tsirkin
2019-04-11 5:46 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2019-04-09 12:50 UTC (permalink / raw)
To: Jason Wang; +Cc: kvm, virtualization, netdev, linux-kernel
On Tue, Apr 09, 2019 at 12:10:25PM +0800, Jason Wang wrote:
> 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: syzbot+d21e6e297322a900c128@syzkaller.appspotmail.com
> Fixes: 6b1e6cc7 ("vhost: new device IOTLB API")
> Signed-off-by: Jason Wang <jasowang@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Seems appropriate for stable.
> ---
> drivers/vhost/vhost.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index 5ace833de746..351af88231ad 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -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;
>
> --
> 2.19.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] vhost: reject zero size iova range
2019-04-09 4:10 [PATCH net] vhost: reject zero size iova range Jason Wang
2019-04-09 12:50 ` Michael S. Tsirkin
@ 2019-04-11 5:46 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-04-11 5:46 UTC (permalink / raw)
To: jasowang; +Cc: mst, kvm, virtualization, netdev, linux-kernel
From: Jason Wang <jasowang@redhat.com>
Date: Tue, 9 Apr 2019 12:10:25 +0800
> 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: syzbot+d21e6e297322a900c128@syzkaller.appspotmail.com
> Fixes: 6b1e6cc7 ("vhost: new device IOTLB API")
> Signed-off-by: Jason Wang <jasowang@redhat.com>
Applied and queued up for -stable.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-04-11 5:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-09 4:10 [PATCH net] vhost: reject zero size iova range Jason Wang
2019-04-09 12:50 ` Michael S. Tsirkin
2019-04-11 5:46 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).