From patchwork Thu Apr 26 10:17:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Pepper X-Patchwork-Id: 10365355 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 A2578602DC for ; Thu, 26 Apr 2018 10:28:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92B80286E4 for ; Thu, 26 Apr 2018 10:28:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8750D2874F; Thu, 26 Apr 2018 10:28:02 +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 0A81E286E4 for ; Thu, 26 Apr 2018 10:28:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755168AbeDZK2A (ORCPT ); Thu, 26 Apr 2018 06:28:00 -0400 Received: from mail-out-2.itc.rwth-aachen.de ([134.130.5.47]:46770 "EHLO mail-out-2.itc.rwth-aachen.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754864AbeDZK17 (ORCPT ); Thu, 26 Apr 2018 06:27:59 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2C9BwAKp+Fa/6EagoZbHAEBAQQBAQoBA?= =?us-ascii?q?YNDggMKmFqDA5UGCyyEQAKDECE4FAECAQEBAQEBAmwohSMGJ1IQRgtXBg4FhQ8?= =?us-ascii?q?EqRQzg3SEZYJFCQGFY4IkgVQ/gTKCOop1AocSkHQIdW6MXIdOhQuQEgICAgIJA?= =?us-ascii?q?hSBJTMhgVIzGiSDEoIgFxGOCG15HA+OagGBFwEB?= X-IPAS-Result: =?us-ascii?q?A2C9BwAKp+Fa/6EagoZbHAEBAQQBAQoBAYNDggMKmFqDA5U?= =?us-ascii?q?GCyyEQAKDECE4FAECAQEBAQEBAmwohSMGJ1IQRgtXBg4FhQ8EqRQzg3SEZYJFC?= =?us-ascii?q?QGFY4IkgVQ/gTKCOop1AocSkHQIdW6MXIdOhQuQEgICAgIJAhSBJTMhgVIzGiS?= =?us-ascii?q?DEoIgFxGOCG15HA+OagGBFwEB?= X-IronPort-AV: E=Sophos;i="5.49,330,1520895600"; d="scan'208";a="44112850" Received: from rwthex-s3-b.rwth-ad.de ([134.130.26.161]) by mail-in-2.itc.rwth-aachen.de with ESMTP; 26 Apr 2018 12:18:19 +0200 Received: from localhost.localdomain (37.201.181.173) by rwthex-s3-b.rwth-ad.de (2002:8682:1aa1::8682:1aa1) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1415.2; Thu, 26 Apr 2018 12:18:17 +0200 From: Joel Pepper To: Laurent Pinchart CC: Felipe Balbi , Greg Kroah-Hartman , , Paul Elder , Joel Pepper Subject: [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: Thu, 26 Apr 2018 12:17:53 +0200 X-Mailer: git-send-email 2.1.4 In-Reply-To: <1524737874-25218-1-git-send-email-joel.pepper@rwth-aachen.de> References: <3b77fb45-5ea3-4622-9473-538b4f80be1e@rwthex-s3-b.rwth-ad.de> <1524737874-25218-1-git-send-email-joel.pepper@rwth-aachen.de> MIME-Version: 1.0 X-Originating-IP: [37.201.181.173] X-ClientProxiedBy: rwthex-s3-a.rwth-ad.de (2002:8682:1aa0::8682:1aa0) To rwthex-s3-b.rwth-ad.de (2002:8682:1aa1::8682:1aa1) Message-ID: <1179b707-c9ea-40bb-8f34-13e919a0e334@rwthex-s3-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 --- 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);