4cf7022
The uvc_mc_register_entity() function wrongfully selects the
4cf7022
media_entity associated with a UVC entity when creating links. This
4cf7022
results in access to uninitialized media_entity structures and can hit a
4cf7022
BUG_ON statement in media_entity_create_link(). Fix it.
4cf7022
4cf7022
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
4cf7022
---
4cf7022
 drivers/media/video/uvc/uvc_entity.c |    2 +-
4cf7022
 1 files changed, 1 insertions(+), 1 deletions(-)
4cf7022
4cf7022
This patch should fix a v3.0 regression that results in a kernel crash as
4cf7022
reported in http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=637740 and
4cf7022
https://bugzilla.redhat.com/show_bug.cgi?id=735437.
4cf7022
4cf7022
Test results will be welcome.
4cf7022
4cf7022
diff --git a/drivers/media/video/uvc/uvc_entity.c b/drivers/media/video/uvc/uvc_entity.c
4cf7022
index 48fea37..29e2399 100644
4cf7022
--- a/drivers/media/video/uvc/uvc_entity.c
4cf7022
+++ b/drivers/media/video/uvc/uvc_entity.c
4cf7022
@@ -49,7 +49,7 @@ static int uvc_mc_register_entity(struct uvc_video_chain *chain,
4cf7022
 		if (remote == NULL)
4cf7022
 			return -EINVAL;
4cf7022
 
4cf7022
-		source = (UVC_ENTITY_TYPE(remote) != UVC_TT_STREAMING)
4cf7022
+		source = (UVC_ENTITY_TYPE(remote) == UVC_TT_STREAMING)
4cf7022
 		       ? (remote->vdev ? &remote->vdev->entity : NULL)
4cf7022
 		       : &remote->subdev.entity;
4cf7022
 		if (source == NULL)
4cf7022
-- 
4cf7022
Regards,
4cf7022
4cf7022
Laurent Pinchart
4cf7022