Skip to contentSkip to conversation

Patch "[media] zr364xx: enforce minimum size when reading header" has been added to the 4.11-stable tree

PATCH [email protected] 1 participant 1 message May 23, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

[media] zr364xx: enforce minimum size when reading header

to the 4.11-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
zr364xx-enforce-minimum-size-when-reading-header.patch
and it can be found in the queue-4.11 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From ee0fe833d96793853335844b6d99fb76bd12cbeb Mon Sep 17 00:00:00 2001

From: Alyssa Milburn <[email protected]>
Date: Sat, 1 Apr 2017 14:34:08 -0300
Subject: [media] zr364xx: enforce minimum size when reading header

From: Alyssa Milburn <[email protected]>

commit ee0fe833d96793853335844b6d99fb76bd12cbeb upstream.

This code copies actual_length-128 bytes from the header, which will underflow if the received buffer is too small.

---
 drivers/media/usb/zr364xx/zr364xx.c |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/media/usb/zr364xx/zr364xx.c +8 -0
@@ -600,6 +600,14 @@ static int zr364xx_read_video_callback(s
 	ptr = pdest = frm->lpvbits;
 
 	if (frm->ulState == ZR364XX_READ_IDLE) {
+		if (purb->actual_length < 128) {
+			/* header incomplete */
+			dev_info(&cam->udev->dev,
+				 "%s: buffer (%d bytes) too small to hold jpeg header. Discarding.\n",
+				 __func__, purb->actual_length);
+			return -EINVAL;
+		}
+
 		frm->ulState = ZR364XX_READ_FRAME;
 		frm->cur_size = 0;
 

Patches currently in stable-queue which might be from [email protected] are

queue-4.11/digitv-limit-messages-to-buffer-size.patch queue-4.11/ttusb2-limit-messages-to-buffer-size.patch queue-4.11/zr364xx-enforce-minimum-size-when-reading-header.patch queue-4.11/dw2102-limit-messages-to-buffer-size.patch