FAILED: patch "[PATCH] drm/virtio: bound EDID block reads to the response buffer" failed to apply to 5.10-stable tree
Subsystems (4)
[email protected]
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x 4e1a53892ba7f8a3e1da6bfc53c83ae7c812dccd
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026072943-outpost-ladle-390c@gregkh' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 4e1a53892ba7f8a3e1da6bfc53c83ae7c812dccd Mon Sep 17 00:00:00 2001
From: Bryam Vargas <[email protected]>
Date: Sat, 20 Jun 2026 21:43:34 -0500
Subject: [PATCH] drm/virtio: bound EDID block reads to the response buffer
virtio_get_edid_block() validates the read offset only against the device-supplied resp->size field, never against the fixed-size resp->edid array. The EDID block index is driven by the device-supplied extension count, so a malicious virtio-gpu backend can advertise a large size together with a high block count and read far past the array into adjacent kernel memory, which is then surfaced in the parsed EDID (an out-of-bounds read / info leak).
Also reject any read whose end exceeds the size of the edid array. Conforming EDID responses stay within the array and are unaffected.
drivers/gpu/drm/virtio/virtgpu_vq.c +2 -1
@@ -897,7 +897,8 @@ static int virtio_get_edid_block(void *data, u8 *buf,struct virtio_gpu_resp_edid *resp = data;size_t start = block *EDID_LENGTH ; -if (start + len >le32_to_cpu (resp->size)) +if (start + len >le32_to_cpu (resp->size) || + start + len >sizeof (resp->edid))return -EINVAL ;memcpy (buf, resp->edid + start, len);return 0 ;
Sasha Levin
maintainerPATCH 1/2 drm/virtio: Return proper error codes instead of -1
From: Dmitry Osipenko <[email protected]>
[ Upstream commit 4c703f5d6f776eaa6a98611c9b5dfe800fbeb0c8 ]
Don't return -1 in error cases, return proper error code. The returned error codes propagate to error messages and to userspace and it's always good to have a meaningful error number for debugging purposes.
Stable-dep-of: 4e1a53892ba7 ("drm/virtio: bound EDID block reads to the response buffer")
--- drivers/gpu/drm/virtio/virtgpu_vq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/virtio/virtgpu_vq.c +3 -3
@@ -329,7 +329,7 @@ static int virtio_gpu_queue_ctrl_sgs(struct virtio_gpu_device *vgdev,if (fence && vbuf->objs)virtio_gpu_array_unlock_resv (vbuf->objs);free_vbuf (vgdev, vbuf); -return -1 ; +return -ENODEV ; }if (vgdev->has_indirect)
@@ -393,7 +393,7 @@ static int virtio_gpu_queue_fenced_ctrl_buffer(struct virtio_gpu_device *vgdev,if (!sgt) {if (fence && vbuf->objs)virtio_gpu_array_unlock_resv (vbuf->objs); -return -1 ; +return -ENOMEM ; } elemcnt += sg_ents;
@@ -725,7 +725,7 @@ static int virtio_get_edid_block(void *data, u8 *buf,size_t start = block *EDID_LENGTH ;if (start + len >le32_to_cpu (resp->size)) -return -1 ; +return -EINVAL ;memcpy (buf, resp->edid + start, len);return 0 ; }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/2 drm/virtio: bound EDID block reads to the response buffer
From: Bryam Vargas <[email protected]>
[ Upstream commit 4e1a53892ba7f8a3e1da6bfc53c83ae7c812dccd ]
virtio_get_edid_block() validates the read offset only against the device-supplied resp->size field, never against the fixed-size resp->edid array. The EDID block index is driven by the device-supplied extension count, so a malicious virtio-gpu backend can advertise a large size together with a high block count and read far past the array into adjacent kernel memory, which is then surfaced in the parsed EDID (an out-of-bounds read / info leak).
Also reject any read whose end exceeds the size of the edid array. Conforming EDID responses stay within the array and are unaffected.
--- drivers/gpu/drm/virtio/virtgpu_vq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/virtio/virtgpu_vq.c +2 -1
@@ -724,7 +724,8 @@ static int virtio_get_edid_block(void *data, u8 *buf,struct virtio_gpu_resp_edid *resp = data;size_t start = block *EDID_LENGTH ; -if (start + len >le32_to_cpu (resp->size)) +if (start + len >le32_to_cpu (resp->size) || + start + len >sizeof (resp->edid))return -EINVAL ;memcpy (buf, resp->edid + start, len);return 0 ;
Signature · 1 line
2.53.0