• Hans Verkuil's avatar
    media: v4l2-ioctl.c: fix incorrect error path · f0da34f3
    Hans Verkuil authored
    If allocating array_buf fails, or copying data from userspace into that
    buffer fails, then just free memory and return the error. Don't attempt
    to call video_put_user() since there is no point, and it would copy back
    data on error even if INFO_FL_ALWAYS_COPY wasn't set.
    
    So if writing the array back to userspace fails, then don't go to
    out_array_args, instead just continue with the regular code that just
    returns the error unless 'always_copy' is set.
    
    Update the VIDIOC_G/S/TRY_EXT_CTRLS ioctls to set the ALWAYS_COPY flag
    since they now need it. Before this worked due to this buggy code, but
    now that that is fixed these ioctls need to set this flag explicitly.
    Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
    f0da34f3
v4l2-ioctl.c 110 KB