Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2455534pxj; Mon, 10 May 2021 03:29:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHhfyf/02bFmXjnSClwFBffpcU50fySqiGUabLvo0rJGAiJ/qhL9fOtSMbjP7+ivPdgkQ+ X-Received: by 2002:a17:906:8904:: with SMTP id fr4mr25282112ejc.146.1620642540299; Mon, 10 May 2021 03:29:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620642540; cv=none; d=google.com; s=arc-20160816; b=A3KY5Vagcf5BoGVkKjeQo7Ptt24m2nHpiyeA9Wje3phkSIgX9+yFnB6FONA5EkzNU7 fUNnFCcie0dplkL58Qap2wfA/Kpswke5bLb1/JIiDyntuwmnfE6RUjbw3qlPlPLaBzS9 tZk9MFjuxIc+c+acqVJ5gk6rDaY2cv0Jiu3+sbVRyrhBRf2sOGvzmMkJEV4WOqcEcXdt Lv7r8F5beEUOIgfyvNfiIWkroYG8Fa1wf6fQgZS5kR58c3ASpuxicKRCuxXAe0j/A5Bn 8N2hCq7UJEf9Du4jhX4zVMOqX9brtvKpIzbkcwYLu0TEy1mh0PtUIkyIEo03zuqCtH/b oL3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FEtpIOIIiBbm8ytddJRj/M2DNHKbqE2V7iydZlbUwDc=; b=oCRvPqSH/cpvKdk20ZKLI+DiKBcmC8BZwB2Qn6j0YyIR13iNY8PruP7USvoH8lqEyp fAUi7PYC2BR3hJgFa5rhLFJzh7F9BaEAtp2iMjifezvq+OWfKsz5O4lTdUkj4KLPllIg CZXAY0B4QrZqaON62FuCBkafHHKR1pamA+R5fbyR5pglqrL33Ilpf3nK4oCRQ58XIQFe XQHjdzJcJbGizP8KHgqDJzGWgYHJ3ARf4BZ8MG2TjBijJl4tv8PL8OAOYYackyeLAIb1 wDP35zDjKQeCncSbJOEL5zPtoUBrXFElXw8Rg5PHRWT+cY4946415hu0V7gEZX5lihpe VJvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tH7928YD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n26si12462241eje.251.2021.05.10.03.28.36; Mon, 10 May 2021 03:29:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tH7928YD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230381AbhEJK1x (ORCPT + 99 others); Mon, 10 May 2021 06:27:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:60102 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231294AbhEJK0Y (ORCPT ); Mon, 10 May 2021 06:26:24 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0131B6144F; Mon, 10 May 2021 10:25:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620642319; bh=3JCObTlt8rKpUblB5+e5ISvpfdKGj4o30QkkRzT5HZs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tH7928YDb1zNMGRQhgAVkjyRRmidtt6DPSmSoGCgBjTdXJXOrrIy4OAJJQMeuDajp ol/tPObdAw6zf5eQOugBbeV0H3S4n4MnXYX0TsIKKfRStVn15A7k5V9/fTaN1QFU1A nbmxlqR9cfPhWKu0la+eRna4Qnme3KtUiT4mBBzI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Laurent Pinchart , Pawel Laszczak , Peter Chen , Sasha Levin Subject: [PATCH 5.4 045/184] usb: webcam: Invalid size of Processing Unit Descriptor Date: Mon, 10 May 2021 12:18:59 +0200 Message-Id: <20210510101951.680457606@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510101950.200777181@linuxfoundation.org> References: <20210510101950.200777181@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pawel Laszczak [ Upstream commit 6a154ec9ef6762c774cd2b50215c7a8f0f08a862 ] According with USB Device Class Definition for Video Device the Processing Unit Descriptor bLength should be 12 (10 + bmControlSize), but it has 11. Invalid length caused that Processing Unit Descriptor Test Video form CV tool failed. To fix this issue patch adds bmVideoStandards into uvc_processing_unit_descriptor structure. The bmVideoStandards field was added in UVC 1.1 and it wasn't part of UVC 1.0a. Reviewed-by: Laurent Pinchart Signed-off-by: Pawel Laszczak Reviewed-by: Peter Chen Link: https://lore.kernel.org/r/20210315071748.29706-1-pawell@gli-login.cadence.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/gadget/function/f_uvc.c | 1 + drivers/usb/gadget/legacy/webcam.c | 1 + include/uapi/linux/usb/video.h | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c index 79ecdbb936c1..c03b67aab1a8 100644 --- a/drivers/usb/gadget/function/f_uvc.c +++ b/drivers/usb/gadget/function/f_uvc.c @@ -822,6 +822,7 @@ static struct usb_function_instance *uvc_alloc_inst(void) pd->bmControls[0] = 1; pd->bmControls[1] = 0; pd->iProcessing = 0; + pd->bmVideoStandards = 0; od = &opts->uvc_output_terminal; od->bLength = UVC_DT_OUTPUT_TERMINAL_SIZE; diff --git a/drivers/usb/gadget/legacy/webcam.c b/drivers/usb/gadget/legacy/webcam.c index a9f8eb8e1c76..2c9eab2b863d 100644 --- a/drivers/usb/gadget/legacy/webcam.c +++ b/drivers/usb/gadget/legacy/webcam.c @@ -125,6 +125,7 @@ static const struct uvc_processing_unit_descriptor uvc_processing = { .bmControls[0] = 1, .bmControls[1] = 0, .iProcessing = 0, + .bmVideoStandards = 0, }; static const struct uvc_output_terminal_descriptor uvc_output_terminal = { diff --git a/include/uapi/linux/usb/video.h b/include/uapi/linux/usb/video.h index d854cb19c42c..bfdae12cdacf 100644 --- a/include/uapi/linux/usb/video.h +++ b/include/uapi/linux/usb/video.h @@ -302,9 +302,10 @@ struct uvc_processing_unit_descriptor { __u8 bControlSize; __u8 bmControls[2]; __u8 iProcessing; + __u8 bmVideoStandards; } __attribute__((__packed__)); -#define UVC_DT_PROCESSING_UNIT_SIZE(n) (9+(n)) +#define UVC_DT_PROCESSING_UNIT_SIZE(n) (10+(n)) /* 3.7.2.6. Extension Unit Descriptor */ struct uvc_extension_unit_descriptor { -- 2.30.2