]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
media: vivid: Fix global-out-of-bounds read in precalculate_color()
authorPeilin Ye <yepeilin.cs@gmail.com>
Fri, 21 Aug 2020 12:46:45 +0000 (14:46 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 09:07:18 +0000 (10:07 +0100)
commit1c1e39f91ffe7b635f53f81ba3d010195abb2526
tree30681fbc8eeb6a44f3f1364e4e74617f1b0b7e10
parent0ebbe42a9a4c9da9ef291ccc997636a306f9ff83
media: vivid: Fix global-out-of-bounds read in precalculate_color()

[ Upstream commit e3158a5e7e661786b3ab650c7e4d21024e8eff0f ]

vivid_meta_out_process() is setting `brightness`, `contrast`, `saturation`
and `hue` using tpg_s_*(). This is wrong, since tpg_s_*() do not provide
range checks. Using tpg_s_*() here also makes the control framework
out-of-sync with the actual values. Use v4l2_ctrl_s_ctrl() instead.

This issue has been reported by syzbot as an out-of-bounds read bug in
precalculate_color().

Reported-and-tested-by: syzbot+02d9172bf4c43104cd70@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=02d9172bf4c43104cd70
Fixes: 746facd39370 ("media: vivid: Add metadata output support")
Suggested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Peilin Ye <yepeilin.cs@gmail.com>
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/test-drivers/vivid/vivid-meta-out.c