]> git.baikalelectronics.ru Git - kernel.git/commit
[media] v4l: uvcvideo: Fix buffer completion size check
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Tue, 30 Sep 2014 21:28:42 +0000 (18:28 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 21 Oct 2014 10:53:27 +0000 (08:53 -0200)
commitf44e86e6717ea01b573fecf0c50c32388edc034a
tree7f55147e7456f864f941ccbd89d6be897f544850
parent28f54f366fa684c69d380cb137d9d1fe8e2363bd
[media] v4l: uvcvideo: Fix buffer completion size check

Commit 57b92c0f58d1e809d4b5c79056f1e5febff7745f ("v4l2: uvcvideo: Allow
using larger buffers") reworked the buffer size sanity check at buffer
completion time to use the frame size instead of the allocated buffer
size. However, it introduced two bugs in doing so:

- it assigned the allocated buffer size to the frame_size field, instead
  of assigning the correct frame size

- it performed the assignment in the S_FMT handler, resulting in the
  frame_size field being uninitialized if the userspace application
  doesn't call S_FMT.

Fix both issues by removing the frame_size field and validating the
buffer size against the UVC video control dwMaxFrameSize.

Fixes: 57b92c0f58d1 ("v4l2: uvcvideo: Allow using larger buffers")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/usb/uvc/uvc_v4l2.c
drivers/media/usb/uvc/uvc_video.c
drivers/media/usb/uvc/uvcvideo.h