summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Ribalda <ribalda@chromium.org>2022-09-20 16:04:55 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-11 16:32:00 +0100
commit2914259fcea23971c6fed8b2618d3a729a78c365 (patch)
tree49e4e612289722c8adaad1e3a575d1d861078288
parent00f5e1edb479abb2f1b24acb5198149e4f2132fc (diff)
downloadlinux-2914259fcea23971c6fed8b2618d3a729a78c365.tar.gz
linux-2914259fcea23971c6fed8b2618d3a729a78c365.tar.bz2
linux-2914259fcea23971c6fed8b2618d3a729a78c365.zip
media: uvcvideo: Handle cameras with invalid descriptors
[ Upstream commit 41ddb251c68ac75c101d3a50a68c4629c9055e4c ] If the source entity does not contain any pads, do not create a link. Reported-by: syzbot <syzkaller@googlegroups.com> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/media/usb/uvc/uvc_entity.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/usb/uvc/uvc_entity.c b/drivers/media/usb/uvc/uvc_entity.c
index f2457953f27c..0d5aaaa7e2d9 100644
--- a/drivers/media/usb/uvc/uvc_entity.c
+++ b/drivers/media/usb/uvc/uvc_entity.c
@@ -42,7 +42,7 @@ static int uvc_mc_create_links(struct uvc_video_chain *chain,
continue;
remote = uvc_entity_by_id(chain->dev, entity->baSourceID[i]);
- if (remote == NULL)
+ if (remote == NULL || remote->num_pads == 0)
return -EINVAL;
source = (UVC_ENTITY_TYPE(remote) == UVC_TT_STREAMING)