From 76ebc16b87592350e4ea70681855171adf73f055 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Fran=C3=A7ois=20Moine?= Date: Sat, 25 Dec 2010 13:22:21 -0300 Subject: [PATCH] [media] gspca - main: Check the isoc packet status before its length MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When an error is set for an isochronous packet, the length of the packet may be null. In this case, the error was not detected and the image was not discarded as it should be. Reported-by: Franck Bourdonnec Signed-off-by: Jean-François Moine Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/gspca.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c index 5a2274b2b0e8..03381c68b986 100644 --- a/drivers/media/video/gspca/gspca.c +++ b/drivers/media/video/gspca/gspca.c @@ -320,12 +320,6 @@ static void fill_frame(struct gspca_dev *gspca_dev, for (i = 0; i < urb->number_of_packets; i++) { /* check the packet status and length */ - len = urb->iso_frame_desc[i].actual_length; - if (len == 0) { - if (gspca_dev->empty_packet == 0) - gspca_dev->empty_packet = 1; - continue; - } st = urb->iso_frame_desc[i].status; if (st) { err("ISOC data error: [%d] len=%d, status=%d", @@ -333,6 +327,12 @@ static void fill_frame(struct gspca_dev *gspca_dev, gspca_dev->last_packet_type = DISCARD_PACKET; continue; } + len = urb->iso_frame_desc[i].actual_length; + if (len == 0) { + if (gspca_dev->empty_packet == 0) + gspca_dev->empty_packet = 1; + continue; + } /* let the packet be analyzed by the subdriver */ PDEBUG(D_PACK, "packet [%d] o:%d l:%d", -- 2.30.2