WSL2-Linux-Kernel/drivers/vdpa/vdpa_user
Harshit Mogalapalli 308d24d875 vduse: Validate vq_num in vduse_validate_config()
[ Upstream commit 937c783aa3 ]

Add a limit to 'config->vq_num' which is user controlled data which
comes from an vduse_ioctl to prevent large memory allocations.

Micheal says  - This limit is somewhat arbitrary.
However, currently virtio pci and ccw are limited to a 16 bit vq number.
While MMIO isn't it is also isn't used with lots of VQs due to
current lack of support for per-vq interrupts.
Thus, the 0xffff limit on number of VQs corresponding
to a 16-bit VQ number seems sufficient for now.

This is found using static analysis with smatch.

Suggested-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Message-Id: <20221128155717.2579992-1-harshit.m.mogalapalli@oracle.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-01-24 07:22:41 +01:00
..
Makefile
iova_domain.c vduse: Fix returning wrong type in vduse_domain_alloc_iova() 2022-03-16 14:23:36 +01:00
iova_domain.h
vduse_dev.c vduse: Validate vq_num in vduse_validate_config() 2023-01-24 07:22:41 +01:00