aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Fraleigh <chadf@triularity.org>2021-08-29 16:51:27 -0700
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2021-09-03 10:20:16 +0200
commit318afc9d4da02bbf31b14e1d3459f25812f91469 (patch)
tree90e8b4f6822d430fe18a02d23f15b63626e3f9f2
parent16a1e2ea6a14a441e1c04c84637d333e879e05b8 (diff)
gspca: Limit frame size to sizeimage.br-v5.16cfor-v5.16c
Limit frame size to what userland code expects. This can happen when cameras, such as Kensington VideoCAM, use fixed sized transfer packets which includes trailing junk in the final packet. Signed-off-by: Chad Fraleigh <chadf@triularity.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--drivers/media/usb/gspca/gspca.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c
index 47d8f28bfdfc..770714c34295 100644
--- a/drivers/media/usb/gspca/gspca.c
+++ b/drivers/media/usb/gspca/gspca.c
@@ -444,6 +444,8 @@ void gspca_frame_add(struct gspca_dev *gspca_dev,
* next first packet, wake up the application and advance
* in the queue */
if (packet_type == LAST_PACKET) {
+ if (gspca_dev->image_len > gspca_dev->pixfmt.sizeimage)
+ gspca_dev->image_len = gspca_dev->pixfmt.sizeimage;
spin_lock_irqsave(&gspca_dev->qlock, flags);
list_del(&buf->list);
spin_unlock_irqrestore(&gspca_dev->qlock, flags);

Privacy Policy