android_kernel_samsung_a7y1.../drivers/vhost
yongduan 0c009e0e0e vhost: make sure log_num < in_num
commit 060423bfdee3f8bc6e2c1bac97de24d5415e2bc4 upstream.

The code assumes log_num < in_num everywhere, and that is true as long as
in_num is incremented by descriptor iov count, and log_num by 1. However
this breaks if there's a zero sized descriptor.

As a result, if a malicious guest creates a vring desc with desc.len = 0,
it may cause the host kernel to crash by overflowing the log array. This
bug can be triggered during the VM migration.

There's no need to log when desc.len = 0, so just don't increment log_num
in this case.

Fixes: 3a4d5c94e959 ("vhost_net: a kernel-level virtio server")
Cc: stable@vger.kernel.org
Reviewed-by: Lidong Chen <lidongchen@tencent.com>
Signed-off-by: ruippan <ruippan@tencent.com>
Signed-off-by: yongduan <yongduan@tencent.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-06 21:35:05 +02:00
..
Kconfig A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Kconfig.vringh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
net.c vhost_net: fix possible infinite loop 2020-04-06 21:32:13 +02:00
scsi.c vhost: scsi: add weight support 2020-04-06 21:32:37 +02:00
test.c vhost/test: fix build for vhost test 2020-04-06 21:34:55 +02:00
test.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
vhost.c vhost: make sure log_num < in_num 2020-04-06 21:35:05 +02:00
vhost.h vhost: introduce vhost_exceeds_weight() 2020-04-06 21:24:49 +02:00
vringh.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
vsock.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30