]> git.baikalelectronics.ru Git - kernel.git/commit
media: v4l2-core: compat: ignore native command codes
authorArnd Bergmann <arnd@arndb.de>
Mon, 16 Dec 2019 14:15:01 +0000 (15:15 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Fri, 3 Jan 2020 14:45:02 +0000 (15:45 +0100)
commitd13574ef0ada989d07ddc1ee2737a2502e4cd910
tree32c92ad85c3b3472eba0b470c61ba84e058ed874
parent5e64eb86f375e5cfcd2dbf22afd88d84c2c4cf7e
media: v4l2-core: compat: ignore native command codes

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: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/v4l2-core/v4l2-compat-ioctl32.c