Skip to content

Commit ba97b7a

Browse files
IgorTorrente-colgregkh
authored andcommitted
Revert "virtio: reject shm region if length is zero"
[ Upstream commit ced17ee ] The commit 206cc44 ("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: 206cc44 ("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>
1 parent 8d94754 commit ba97b7a

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

include/linux/virtio_config.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,6 @@ static inline
329329
bool virtio_get_shm_region(struct virtio_device *vdev,
330330
struct virtio_shm_region *region, u8 id)
331331
{
332-
if (!region->len)
333-
return false;
334332
if (!vdev->config->get_shm_region)
335333
return false;
336334
return vdev->config->get_shm_region(vdev, region, id);

0 commit comments

Comments
 (0)