diff options
| author | Igor Torrente <igor.torrente@collabora.com> | 2025-08-07 09:41:45 -0300 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-09-04 16:55:30 +0200 |
| commit | ba97b7a8a2089f940d2d0fd41ebdc1f2e1da13c2 (patch) | |
| tree | 9f46725e9ee0dfb1b702a686077c39ae233db47a | |
| parent | 8d947540ee118ae3bdb14888c7d989580ffc8b35 (diff) | |
Revert "virtio: reject shm region if length is zero"
[ Upstream commit ced17ee32a9988b8a260628e7c31a100d7dc082e ]
The commit 206cc44588f7 ("virtio: reject shm region if length is zero")
breaks the Virtio-gpu `host_visible` feature.
As you can see in the snippet below, host_visible_region is zero because
of the `kzalloc`. It's using the `vm_get_shm_region`
(drivers/virtio/virtio_mmio.c:536) to read the `addr` and `len` from
qemu/crosvm.
```
drivers/gpu/drm/virtio/virtgpu_kms.c
132 vgdev = drmm_kzalloc(dev, sizeof(struct virtio_gpu_device), GFP_KERNEL);
[...]
177 if (virtio_get_shm_region(vgdev->vdev, &vgdev->host_visible_region,
178 VIRTIO_GPU_SHM_ID_HOST_VISIBLE)) {
```
Now it always fails.
To fix, revert the offending commit.
Fixes: 206cc44588f7 ("virtio: reject shm region if length is zero")
Signed-off-by: Igor Torrente <igor.torrente@collabora.com>
Message-Id: <20250807124145.81816-1-igor.torrente@collabora.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
| -rw-r--r-- | include/linux/virtio_config.h | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h index b3e1d30c765b..169c7d367fac 100644 --- a/include/linux/virtio_config.h +++ b/include/linux/virtio_config.h @@ -329,8 +329,6 @@ 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); |
