From: Laurent Pinchart Date: Tue, 6 Sep 2011 22:16:18 +0000 (-0300) Subject: uvcvideo: Fix crash when linking entities X-Git-Tag: firefly_0821_release~7541^2~2582 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=16b2b5c638c12ffc89753ad19edeb9baa6f59b99;p=firefly-linux-kernel-4.4.55.git uvcvideo: Fix crash when linking entities commit 4d9b2ebd335d83044b9e6656d0e604e8e1300334 upstream. The uvc_mc_register_entity() function wrongfully selects the media_entity associated with a UVC entity when creating links. This results in access to uninitialized media_entity structures and can hit a BUG_ON statement in media_entity_create_link(). Fix it. Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab Cc: Josh Boyer Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/media/video/uvc/uvc_entity.c b/drivers/media/video/uvc/uvc_entity.c index 48fea373c25a..29e239911d0e 100644 --- a/drivers/media/video/uvc/uvc_entity.c +++ b/drivers/media/video/uvc/uvc_entity.c @@ -49,7 +49,7 @@ static int uvc_mc_register_entity(struct uvc_video_chain *chain, if (remote == NULL) return -EINVAL; - source = (UVC_ENTITY_TYPE(remote) != UVC_TT_STREAMING) + source = (UVC_ENTITY_TYPE(remote) == UVC_TT_STREAMING) ? (remote->vdev ? &remote->vdev->entity : NULL) : &remote->subdev.entity; if (source == NULL)