• Arnd Bergmann's avatar
    media: v4l2-core: compat: ignore native command codes · 4a873f3f
    Arnd Bergmann authored
    The do_video_ioctl() compat handler converts the compat command
    codes into the native ones before processing further, but this
    causes problems for 32-bit user applications that pass a command
    code that matches a 64-bit native number, which will then be
    handled the same way.
    
    Specifically, this breaks VIDIOC_DQEVENT_TIME from user space
    applications with 64-bit time_t, as the structure layout is
    the same as the native 64-bit layout on many architectures
    (x86 being the notable exception).
    
    Change the handler to use the converted command code only for
    passing into the native ioctl handler, not for deciding on the
    conversion, in order to make the compat behavior match the
    native behavior.
    
    Actual support for the 64-bit time_t version of VIDIOC_DQEVENT_TIME
    and other commands still needs to be added in a separate patch.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
    4a873f3f
v4l2-compat-ioctl32.c 41.2 KB