• Laurent Pinchart's avatar
    [media] v4l: uvcvideo: Fix buffer completion size check · c601f53f
    Laurent Pinchart authored
    Commit e93e7fd9 ("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: e93e7fd9 ("v4l2: uvcvideo: Allow using larger buffers")
    Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
    c601f53f
uvc_v4l2.c 32.4 KB