* [PATCH AUTOSEL 5.4 20/40] media: mceusb: sanity check for prescaler value
[not found] <20210224125340.483162-1-sashal@kernel.org>
@ 2021-02-24 12:53 ` Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 21/40] media: v4l2-ctrls.c: fix shift-out-of-bounds in std_validate Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 22/40] media: uvcvideo: Allow entities with no pads Sasha Levin
2 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2021-02-24 12:53 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Sean Young, syzbot+6d31bf169a8265204b8d, Mauro Carvalho Chehab,
Sasha Levin, linux-media
From: Sean Young <sean@mess.org>
[ Upstream commit 9dec0f48a75e0dadca498002d25ef4e143e60194 ]
prescaler larger than 8 would mean the carrier is at most 152Hz,
which does not make sense for IR carriers.
Reported-by: syzbot+6d31bf169a8265204b8d@syzkaller.appspotmail.com
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/media/rc/mceusb.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index f9616158bcf44..ca8995595c028 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -701,11 +701,18 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, u8 *buf, int buf_len,
data[0], data[1]);
break;
case MCE_RSP_EQIRCFS:
+ if (!data[0] && !data[1]) {
+ dev_dbg(dev, "%s: no carrier", inout);
+ break;
+ }
+ // prescaler should make sense
+ if (data[0] > 8)
+ break;
period = DIV_ROUND_CLOSEST((1U << data[0] * 2) *
(data[1] + 1), 10);
if (!period)
break;
- carrier = (1000 * 1000) / period;
+ carrier = USEC_PER_SEC / period;
dev_dbg(dev, "%s carrier of %u Hz (period %uus)",
inout, carrier, period);
break;
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH AUTOSEL 5.4 21/40] media: v4l2-ctrls.c: fix shift-out-of-bounds in std_validate
[not found] <20210224125340.483162-1-sashal@kernel.org>
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 20/40] media: mceusb: sanity check for prescaler value Sasha Levin
@ 2021-02-24 12:53 ` Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 22/40] media: uvcvideo: Allow entities with no pads Sasha Levin
2 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2021-02-24 12:53 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Hans Verkuil, syzbot+42d8c7c3d3e594b34346, Mauro Carvalho Chehab,
Sasha Levin, linux-media
From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[ Upstream commit 048c96e28674f15c0403deba2104ffba64544a06 ]
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@xs4all.nl>
Reported-by: syzbot+42d8c7c3d3e594b34346@syzkaller.appspotmail.com
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/media/v4l2-core/v4l2-ctrls.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index cd84dbbf6a890..3fe99519fedfb 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -1795,7 +1795,8 @@ static int std_validate(const struct v4l2_ctrl *ctrl, u32 idx,
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')
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH AUTOSEL 5.4 22/40] media: uvcvideo: Allow entities with no pads
[not found] <20210224125340.483162-1-sashal@kernel.org>
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 20/40] media: mceusb: sanity check for prescaler value Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 21/40] media: v4l2-ctrls.c: fix shift-out-of-bounds in std_validate Sasha Levin
@ 2021-02-24 12:53 ` Sasha Levin
2 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2021-02-24 12:53 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Ricardo Ribalda, Laurent Pinchart, Mauro Carvalho Chehab,
Sasha Levin, linux-media
From: Ricardo Ribalda <ribalda@chromium.org>
[ Upstream commit 7532dad6634031d083df7af606fac655b8d08b5c ]
Avoid an underflow while calculating the number of inputs for entities
with zero pads.
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/media/usb/uvc/uvc_driver.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 99883550375e9..40ca1d4e03483 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -967,7 +967,10 @@ static struct uvc_entity *uvc_alloc_entity(u16 type, u8 id,
unsigned int i;
extra_size = roundup(extra_size, sizeof(*entity->pads));
- num_inputs = (type & UVC_TERM_OUTPUT) ? num_pads : num_pads - 1;
+ if (num_pads)
+ num_inputs = type & UVC_TERM_OUTPUT ? num_pads : num_pads - 1;
+ else
+ num_inputs = 0;
size = sizeof(*entity) + extra_size + sizeof(*entity->pads) * num_pads
+ num_inputs;
entity = kzalloc(size, GFP_KERNEL);
@@ -983,7 +986,7 @@ static struct uvc_entity *uvc_alloc_entity(u16 type, u8 id,
for (i = 0; i < num_inputs; ++i)
entity->pads[i].flags = MEDIA_PAD_FL_SINK;
- if (!UVC_ENTITY_IS_OTERM(entity))
+ if (!UVC_ENTITY_IS_OTERM(entity) && num_pads)
entity->pads[num_pads-1].flags = MEDIA_PAD_FL_SOURCE;
entity->bNrInPins = num_inputs;
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-02-24 14:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20210224125340.483162-1-sashal@kernel.org>
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 20/40] media: mceusb: sanity check for prescaler value Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 21/40] media: v4l2-ctrls.c: fix shift-out-of-bounds in std_validate Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 22/40] media: uvcvideo: Allow entities with no pads Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).