mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-09-04 02:25:58 +00:00
virtio: reject shm region if length is zero
Prevent usage of shared memory regions where the length is zero, as such configurations are not valid and may lead to unexpected behavior. Signed-off-by: Sami Uddin <sami.md.ko@gmail.com> Message-Id: <20250511222153.2332-1-sami.md.ko@gmail.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
9d4f22fd56
commit
206cc44588
@ -329,6 +329,8 @@ static inline
|
||||
bool virtio_get_shm_region(struct virtio_device *vdev,
|
||||
struct virtio_shm_region *region, u8 id)
|
||||
{
|
||||
if (!region->len)
|
||||
return false;
|
||||
if (!vdev->config->get_shm_region)
|
||||
return false;
|
||||
return vdev->config->get_shm_region(vdev, region, id);
|
||||
|
Loading…
Reference in New Issue
Block a user