From: Ricardo Ribalda Date: Tue, 20 Sep 2022 14:04:55 +0000 (+0200) Subject: media: uvcvideo: Handle cameras with invalid descriptors X-Git-Tag: v6.3-rc1~72^2~51^2~25 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=41ddb251c68ac75c101d3a50a68c4629c9055e4c;p=linux-2.6-block.git media: uvcvideo: Handle cameras with invalid descriptors If the source entity does not contain any pads, do not create a link. Reported-by: syzbot Signed-off-by: Ricardo Ribalda Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart --- diff --git a/drivers/media/usb/uvc/uvc_entity.c b/drivers/media/usb/uvc/uvc_entity.c index 7c4d2f93d351..cc68dd24eb42 100644 --- a/drivers/media/usb/uvc/uvc_entity.c +++ b/drivers/media/usb/uvc/uvc_entity.c @@ -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)