uvcvideo: Reset the bytesused field when recycling an erroneous buffer
authorJayakrishnan Memana <jayakrishnan.memana@maxim-ic.com>
Sun, 15 Jul 2012 13:54:03 +0000 (10:54 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 Sep 2012 16:59:38 +0000 (09:59 -0700)
commit0c45345d5b34a4c1daa75ca31aa2975820cdf856
tree28aea00260cfbe2705cbcf499d72f9b9a41fa8ac
parentb768c3cb600363139c57dd4448c8c1f45b6b0a95
uvcvideo: Reset the bytesused field when recycling an erroneous buffer

commit 8a3f0ede2b3f5477122060af1a816c6bbf09fcd2 upstream.

Buffers marked as erroneous are recycled immediately by the driver if
the nodrop module parameter isn't set. The buffer payload size is reset
to 0, but the buffer bytesused field isn't. This results in the buffer
being immediately considered as complete, leading to an infinite loop in
interrupt context.

Fix the problem by resetting the bytesused field when recycling the
buffer.

Signed-off-by: Jayakrishnan Memana <jayakrishnan.memana@maxim-ic.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/video/uvc/uvc_queue.c