Skip to content

Commit

Permalink
[media] gspca - main: Check the isoc packet status before its length
Browse files Browse the repository at this point in the history
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 <fbourdonnec@chez.com>
Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Jean-François Moine authored and Mauro Carvalho Chehab committed Dec 29, 2010
1 parent f2c5d92 commit 76ebc16
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions drivers/media/video/gspca/gspca.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,19 +320,19 @@ 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",
i, len, st);
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",
Expand Down

0 comments on commit 76ebc16

Please sign in to comment.