]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
media: v4l2-ctrls-api: fix error handling for v4l2_g_ctrl()
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 15 Oct 2024 12:23:38 +0000 (14:23 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 Nov 2024 12:13:38 +0000 (13:13 +0100)
commit282ad7124652728818ed2d82ddcac6279c446a5a
treef3dbd709226ddeae4a2d723a139edc0419b8759b
parenta749c15dccc58d9cbad9cd23bd8ab4b5fa96cf47
media: v4l2-ctrls-api: fix error handling for v4l2_g_ctrl()

commit 4c76f331a9a173ac8fe1297a9231c2a38f88e368 upstream.

As detected by Coverity, the error check logic at get_ctrl() is
broken: if ptr_to_user() fails to fill a control due to an error,
no errors are returned and v4l2_g_ctrl() returns success on a
failed operation, which may cause applications to fail.

Add an error check at get_ctrl() and ensure that it will
be returned to userspace without filling the control value if
get_ctrl() fails.

Fixes: 71c689dc2e73 ("media: v4l2-ctrls: split up into four source files")
Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/v4l2-core/v4l2-ctrls-api.c