]> git.baikalelectronics.ru Git - kernel.git/commit
media: v4l2-core: fix VIDIOC_DQEVENT handling on non-x86
authorArnd Bergmann <arnd@arndb.de>
Tue, 26 Oct 2021 05:49:54 +0000 (06:49 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Dec 2021 08:04:45 +0000 (09:04 +0100)
commitf9ac7a703a9355eec36b2de20c97a2986b145730
tree60832ea62a262f50fb255684d0e3f3c7858f07c9
parent6b5bd8854d722e8731ad1d98f341cd468787c420
media: v4l2-core: fix VIDIOC_DQEVENT handling on non-x86

[ Upstream commit 39c9b52c0341d6a13bd6ca1397933394900f6e3a ]

My previous bugfix addressed an API inconsistency found by syzbot,
and it correctly fixed the issue on x86-64 machines, which now behave
correctly for both native and compat tasks.

Unfortunately, John found that the patch broke compat mode on all other
architectures, as they can no longer rely on the VIDIOC_DQEVENT_TIME32
code from the native handler as a fallback in the compat code.

The best way I can see for addressing this is to generalize the
VIDIOC_DQEVENT32_TIME32 code from x86 and use that for all architectures,
leaving only the VIDIOC_DQEVENT32 variant as x86 specific. The original
code was trying to be clever and use the same conversion helper for native
32-bit code and compat mode, but that turned out to be too obscure so
even I missed that bit I had introduced myself when I made the fix.

Fixes: 598cc2bbf815 ("media: v4l2-core: ignore native time32 ioctls on 64-bit")
Reported-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/v4l2-core/v4l2-compat-ioctl32.c