Skip to content

Commit

Permalink
media: uvcvideo: Handle cameras with invalid descriptors
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
ribalda authored and pinchartl committed Jan 15, 2023
1 parent 50459f1 commit 41ddb25
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/media/usb/uvc/uvc_entity.c
Expand Up @@ -37,7 +37,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)
Expand Down

0 comments on commit 41ddb25

Please sign in to comment.