From patchwork Tue May 29 19:02:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Pepper X-Patchwork-Id: 10436781 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F1C88604D4 for ; Tue, 29 May 2018 19:03:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E21991FF40 for ; Tue, 29 May 2018 19:03:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6C65201BD; Tue, 29 May 2018 19:03:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6DC51FF40 for ; Tue, 29 May 2018 19:03:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965991AbeE2TDR (ORCPT ); Tue, 29 May 2018 15:03:17 -0400 Received: from mail-out-4.itc.rwth-aachen.de ([134.130.5.49]:54232 "EHLO mail-out-4.itc.rwth-aachen.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965425AbeE2TDQ (ORCPT ); Tue, 29 May 2018 15:03:16 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2B6BACoow1b/6MagoZbGgEBAQEBAgEBA?= =?us-ascii?q?QEIAQEBAYNEggkKmF2BUIE4lTMLLIRAAoIXITcVAQIBAQEBAQECbCiFKQYnUhB?= =?us-ascii?q?GC1cGDgWDIoIBBKdaM4N0hEyBaAkBiCyBVD+BM4I7inUChyORPwcCd3CMc4doh?= =?us-ascii?q?SMBkGQCAgICCQIUgVcigVIzGiSDEoIgFxGOCG15HA+NIwGBGAEB?= X-IPAS-Result: =?us-ascii?q?A2B6BACoow1b/6MagoZbGgEBAQEBAgEBAQEIAQEBAYNEggk?= =?us-ascii?q?KmF2BUIE4lTMLLIRAAoIXITcVAQIBAQEBAQECbCiFKQYnUhBGC1cGDgWDIoIBB?= =?us-ascii?q?KdaM4N0hEyBaAkBiCyBVD+BM4I7inUChyORPwcCd3CMc4dohSMBkGQCAgICCQI?= =?us-ascii?q?UgVcigVIzGiSDEoIgFxGOCG15HA+NIwGBGAEB?= X-IronPort-AV: E=Sophos;i="5.49,457,1520895600"; d="scan'208";a="10645378" Received: from rwthex-w3-b.rwth-ad.de ([134.130.26.163]) by mail-in-4.itc.rwth-aachen.de with ESMTP; 29 May 2018 21:03:15 +0200 Received: from localhost.localdomain (37.201.181.173) by rwthex-w3-b.rwth-ad.de (2002:8682:1aa3::8682:1aa3) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1415.2; Tue, 29 May 2018 21:03:10 +0200 From: Joel Pepper To: Laurent Pinchart CC: Felipe Balbi , , Paul Elder , Joel Pepper Subject: [RESEND][PATCH v6 1/2] usb/gadget/uvc-configfs Fix linked flag in a format not being set when format is linked into streaming header Date: Tue, 29 May 2018 21:02:12 +0200 X-Mailer: git-send-email 2.1.4 In-Reply-To: <1527620533-22918-1-git-send-email-joel.pepper@rwth-aachen.de> References: <352ab863-b819-4751-af7f-0d8f1da72a4d@rwthex-s3-b.rwth-ad.de> <1527620533-22918-1-git-send-email-joel.pepper@rwth-aachen.de> MIME-Version: 1.0 X-Originating-IP: [37.201.181.173] X-ClientProxiedBy: rwthex-w1-a.rwth-ad.de (2002:8682:1a9c::8682:1a9c) To rwthex-w3-b.rwth-ad.de (2002:8682:1aa3::8682:1aa3) Message-ID: <25c6bfeb-a601-45cf-91dd-234349dc2d5e@rwthex-w3-b.rwth-ad.de> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP While checks are in place to avoid attributes and children of a format being manipulated after the format is linked into the streaming header, the linked flag was never actually set, invalidating the protections. Signed-off-by: Joel Pepper Reviewed-by: Laurent Pinchart --- drivers/usb/gadget/function/uvc_configfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/gadget/function/uvc_configfs.c b/drivers/usb/gadget/function/uvc_configfs.c index c9b8cc4a..7a98f9f 100644 --- a/drivers/usb/gadget/function/uvc_configfs.c +++ b/drivers/usb/gadget/function/uvc_configfs.c @@ -760,6 +760,7 @@ static int uvcg_streaming_header_allow_link(struct config_item *src, format_ptr->fmt = target_fmt; list_add_tail(&format_ptr->entry, &src_hdr->formats); ++src_hdr->num_fmt; + ++target_fmt->linked; out: mutex_unlock(&opts->lock); @@ -797,6 +798,8 @@ static void uvcg_streaming_header_drop_link(struct config_item *src, break; } + --target_fmt->linked; + out: mutex_unlock(&opts->lock); mutex_unlock(su_mutex);