Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1805919imm; Mon, 3 Sep 2018 09:55:36 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYID1uUCLazRgLUWzIdLxbEPIpy8ky+Jstv6M0hB5flJyR2sjqYIC6+NItJsYKP9KCxe7eI X-Received: by 2002:a63:88c8:: with SMTP id l191-v6mr27175525pgd.340.1535993736534; Mon, 03 Sep 2018 09:55:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535993736; cv=none; d=google.com; s=arc-20160816; b=KYTcDsFiAvqHpyWhNDSNIaqsIoFWhPzQVpUus8omQUtCe87ObRAAd55HjJ2MTYzdre PaDiQsOpe2GSTos4K19HhLUvfng9nTeR4FniL4ukHp80XFag7f7cGdh2FL2glLbxPpGZ TxYRtM13qOm0lwM4RGov3oQ2OWNSO/iWCyeDDciFTw2s3yzGpgBEiTxIgdQbkDJg7lKU oZ+YLHt2cI4oBwOkeyftX/pqana70OMnQTyi5SAZGj/D/JIm+k0O9zEtz7tAgbYOebno k4aoH9qypiSqNlJBoCch2b/GHO912C2zG1tzQDv+NsqtcSGi/DwHr+cMDMIAk7u6Kkxl ubqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=OMamnIWPsuA4Sad8Fbvp3i8+pOprB7Qg5a7wHMOXcQU=; b=BDpPQSsM/It6MWd8KDQcvj/4jb/3QSfUiNmhvtMI0FjRZSc5oYvIQ6wi5hXhtotfIm GLxk6zBltJdxJwr9DCVsFwgaD3WjHOKY9sMYHCA30PHZa52HqxAhRQ2/nnRn6v7nDGdg 06r0kAttaDPEmLKRFUWkkFy2DhdoLdXT6eHz4NYD0sNzqR/PPzWFtN95r9HSOtRH+xd4 lTSXjGwsSlrz82QXgKmSFSPjJ1FBpxR8DpvfJ/TQ9QWfILIQ5+CZ5KuVbXEeq4++haqQ sH8pIE5tS/1zCCly81hb+6JhP6AtPvVLKHX+LPzxaCzArDshMMfAN/+2EJPkY+6+z/+U iZtg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33-v6si19046037ply.251.2018.09.03.09.55.21; Mon, 03 Sep 2018 09:55:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728818AbeICVO3 (ORCPT + 99 others); Mon, 3 Sep 2018 17:14:29 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:38154 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727861AbeICVO3 (ORCPT ); Mon, 3 Sep 2018 17:14:29 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id BE820CF5; Mon, 3 Sep 2018 16:53:31 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eugeniu Rosca , Ruslan Bilovol , Felipe Balbi , Sasha Levin Subject: [PATCH 4.4 16/80] usb: gadget: f_uac2: fix endianness of struct cntrl_*_lay3 Date: Mon, 3 Sep 2018 18:48:54 +0200 Message-Id: <20180903164934.813217006@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903164934.171677301@linuxfoundation.org> References: <20180903164934.171677301@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eugeniu Rosca [ Upstream commit eec24f2a0d4dc3b1d95a3ccd2feb523ede3ba775 ] The list [1] of commits doing endianness fixes in USB subsystem is long due to below quote from USB spec Revision 2.0 from April 27, 2000: ------------ 8.1 Byte/Bit Ordering Multiple byte fields in standard descriptors, requests, and responses are interpreted as and moved over the bus in little-endian order, i.e. LSB to MSB. ------------ This commit belongs to the same family. [1] Example of endianness fixes in USB subsystem: commit 14e1d56cbea6 ("usb: gadget: f_uac2: endianness fixes.") commit 42370b821168 ("usb: gadget: f_uac1: endianness fixes.") commit 63afd5cc7877 ("USB: chaoskey: fix Alea quirk on big-endian hosts") commit 74098c4ac782 ("usb: gadget: acm: fix endianness in notifications") commit cdd7928df0d2 ("ACM gadget: fix endianness in notifications") commit 323ece54e076 ("cdc-wdm: fix endianness bug in debug statements") commit e102609f1072 ("usb: gadget: uvc: Fix endianness mismatches") list goes on Fixes: 132fcb460839 ("usb: gadget: Add Audio Class 2.0 Driver") Signed-off-by: Eugeniu Rosca Reviewed-by: Ruslan Bilovol Signed-off-by: Felipe Balbi Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/function/f_uac2.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) --- a/drivers/usb/gadget/function/f_uac2.c +++ b/drivers/usb/gadget/function/f_uac2.c @@ -941,14 +941,14 @@ static struct usb_descriptor_header *hs_ }; struct cntrl_cur_lay3 { - __u32 dCUR; + __le32 dCUR; }; struct cntrl_range_lay3 { - __u16 wNumSubRanges; - __u32 dMIN; - __u32 dMAX; - __u32 dRES; + __le16 wNumSubRanges; + __le32 dMIN; + __le32 dMAX; + __le32 dRES; } __packed; static inline void @@ -1296,9 +1296,9 @@ in_rq_cur(struct usb_function *fn, const memset(&c, 0, sizeof(struct cntrl_cur_lay3)); if (entity_id == USB_IN_CLK_ID) - c.dCUR = p_srate; + c.dCUR = cpu_to_le32(p_srate); else if (entity_id == USB_OUT_CLK_ID) - c.dCUR = c_srate; + c.dCUR = cpu_to_le32(c_srate); value = min_t(unsigned, w_length, sizeof c); memcpy(req->buf, &c, value); @@ -1336,15 +1336,15 @@ in_rq_range(struct usb_function *fn, con if (control_selector == UAC2_CS_CONTROL_SAM_FREQ) { if (entity_id == USB_IN_CLK_ID) - r.dMIN = p_srate; + r.dMIN = cpu_to_le32(p_srate); else if (entity_id == USB_OUT_CLK_ID) - r.dMIN = c_srate; + r.dMIN = cpu_to_le32(c_srate); else return -EOPNOTSUPP; r.dMAX = r.dMIN; r.dRES = 0; - r.wNumSubRanges = 1; + r.wNumSubRanges = cpu_to_le16(1); value = min_t(unsigned, w_length, sizeof r); memcpy(req->buf, &r, value);