This is a note to let you know that I've just added the patch titled media: v4l2-ctrls.c: fix shift-out-of-bounds in std_validate to the 5.11-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: media-v4l2-ctrls.c-fix-shift-out-of-bounds-in-std_validate.patch and it can be found in the queue-5.11 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 048c96e28674f15c0403deba2104ffba64544a06 Mon Sep 17 00:00:00 2001 From: Hans Verkuil <hverkuil-cisco@xxxxxxxxx> Date: Wed, 20 Jan 2021 09:28:02 +0100 Subject: media: v4l2-ctrls.c: fix shift-out-of-bounds in std_validate From: Hans Verkuil <hverkuil-cisco@xxxxxxxxx> commit 048c96e28674f15c0403deba2104ffba64544a06 upstream. If a menu has more than 64 items, then don't check menu_skip_mask for items 65 and up. Signed-off-by: Hans Verkuil <hverkuil-cisco@xxxxxxxxx> Reported-by: syzbot+42d8c7c3d3e594b34346@xxxxxxxxxxxxxxxxxxxxxxxxx Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/media/v4l2-core/v4l2-ctrls.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -2165,7 +2165,8 @@ static int std_validate(const struct v4l case V4L2_CTRL_TYPE_INTEGER_MENU: if (ptr.p_s32[idx] < ctrl->minimum || ptr.p_s32[idx] > ctrl->maximum) 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; if (ctrl->type == V4L2_CTRL_TYPE_MENU && ctrl->qmenu[ptr.p_s32[idx]][0] == '\0') Patches currently in stable-queue which might be from hverkuil-cisco@xxxxxxxxx are queue-5.11/media-v4l2-ctrls.c-fix-shift-out-of-bounds-in-std_validate.patch queue-5.11/media-zr364xx-fix-memory-leaks-in-probe.patch