Skip to contentSkip to conversation

virtio: reject shm region if length is zero

PATCH Superseded Sami Uddin [email protected] 1 participant 1 message May 11, 2025 virtio core

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Sami Uddin [email protected]

author
#0 lore raw

PATCH 1/1 virtio: reject shm region if length is zero

From: Sami Uddin <[email protected]>

Prevent usage of shared memory regions where the length is zero, as such configurations are not valid and may lead to unexpected behavior.

---
 include/linux/virtio_config.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/virtio_config.h +2 -0
index 169c7d367fac..f4fac027e830 100644
@@ -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 == 0)
+		return false;
 	if (!vdev->config->get_shm_region)
 		return false;
 	return vdev->config->get_shm_region(vdev, region, id);
Signature · 1 line
2.34.1