summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorRicardo Ribalda <ribalda@chromium.org>2022-09-20 17:04:55 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-11 18:26:53 +0300
commitc8f4a424af5879baefb0fb8a8a09b09ea1779483 (patch)
treef884a993f972c1f3f4192fcffc40c4a558467c5b /drivers/media
parent0d389f834133be8b11b3f3598dcc8435c48cfd69 (diff)
downloadlinux-c8f4a424af5879baefb0fb8a8a09b09ea1779483.tar.xz
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>
Diffstat (limited to 'drivers/media')
-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)