提交 3f115b24 编写于 作者: H Hans Verkuil 提交者: Zheng Zengkai

media: v4l2-ctrls.c: fix shift-out-of-bounds in std_validate

stable inclusion
from stable-5.10.21
commit c55db99fd8c0b1b21ae28d4819a2233fc50b63ce
bugzilla: 50609

--------------------------------

commit 048c96e2 upstream.

If a menu has more than 64 items, then don't check menu_skip_mask
for items 65 and up.
Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl>
Reported-by: syzbot+42d8c7c3d3e594b34346@syzkaller.appspotmail.com
Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 963f66f3
...@@ -1987,7 +1987,8 @@ static int std_validate(const struct v4l2_ctrl *ctrl, u32 idx, ...@@ -1987,7 +1987,8 @@ static int std_validate(const struct v4l2_ctrl *ctrl, u32 idx,
case V4L2_CTRL_TYPE_INTEGER_MENU: case V4L2_CTRL_TYPE_INTEGER_MENU:
if (ptr.p_s32[idx] < ctrl->minimum || ptr.p_s32[idx] > ctrl->maximum) if (ptr.p_s32[idx] < ctrl->minimum || ptr.p_s32[idx] > ctrl->maximum)
return -ERANGE; return -ERANGE;
if (ctrl->menu_skip_mask & (1ULL << ptr.p_s32[idx])) if (ptr.p_s32[idx] < BITS_PER_LONG_LONG &&
(ctrl->menu_skip_mask & BIT_ULL(ptr.p_s32[idx])))
return -EINVAL; return -EINVAL;
if (ctrl->type == V4L2_CTRL_TYPE_MENU && if (ctrl->type == V4L2_CTRL_TYPE_MENU &&
ctrl->qmenu[ptr.p_s32[idx]][0] == '\0') ctrl->qmenu[ptr.p_s32[idx]][0] == '\0')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册