vhost: vsock: add weight support
authorJason Wang <jasowang@redhat.com>
Fri, 17 May 2019 04:29:51 +0000 (00:29 -0400)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 27 May 2019 15:08:23 +0000 (11:08 -0400)
commite79b431fb901ba1106670bcc80b9b617b25def7d
treee23a1637f25ac3f5c980cf225baaee363fb2d23c
parente2412c07f8f3040593dfb88207865a3cd58680c0
vhost: vsock: add weight support

This patch will check the weight and exit the loop if we exceeds the
weight. This is useful for preventing vsock kthread from hogging cpu
which is guest triggerable. The weight can help to avoid starving the
request from on direction while another direction is being processed.

The value of weight is picked from vhost-net.

This addresses CVE-2019-3900.

Cc: Stefan Hajnoczi <stefanha@redhat.com>
Fixes: 433fc58e6bf2 ("VSOCK: Introduce vhost_vsock.ko")
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/vhost/vsock.c