All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Eugeniu Rosca <erosca@de.adit-jv.com>,
	Ruslan Bilovol <ruslan.bilovol@gmail.com>,
	Felipe Balbi <felipe.balbi@linux.intel.com>,
	Sasha Levin <alexander.levin@microsoft.com>
Subject: [PATCH 3.18 14/56] usb: gadget: f_uac2: fix endianness of struct cntrl_*_lay3
Date: Mon,  3 Sep 2018 18:49:04 +0200	[thread overview]
Message-ID: <20180903164924.813770576@linuxfoundation.org> (raw)
In-Reply-To: <20180903164924.078355019@linuxfoundation.org>

3.18-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Eugeniu Rosca <roscaeugeniu@gmail.com>

[ 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 <erosca@de.adit-jv.com>
Reviewed-by: Ruslan Bilovol <ruslan.bilovol@gmail.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>

Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 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
@@ -1274,9 +1274,9 @@ in_rq_cur(struct usb_function *fn, const
 		struct cntrl_cur_lay3 c;
 
 		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);
@@ -1314,15 +1314,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);



  parent reply	other threads:[~2018-09-03 16:50 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-03 16:48 [PATCH 3.18 00/56] 3.18.121-stable review Greg Kroah-Hartman
2018-09-03 16:48 ` [PATCH 3.18 01/56] sched/sysctl: Check user input value of sysctl_sched_time_avg Greg Kroah-Hartman
2018-09-03 16:48 ` [PATCH 3.18 02/56] Cipso: cipso_v4_optptr enter infinite loop Greg Kroah-Hartman
2018-09-03 16:48 ` [PATCH 3.18 03/56] xfrm: fix missing dst_release() after policy blocking lbcast and multicast Greg Kroah-Hartman
2018-09-03 16:48 ` [PATCH 3.18 04/56] xfrm: free skb if nlsk pointer is NULL Greg Kroah-Hartman
2018-09-03 16:48 ` [PATCH 3.18 05/56] mac80211: add stations tied to AP_VLANs during hw reconfig Greg Kroah-Hartman
2018-09-03 16:48 ` [PATCH 3.18 06/56] nl80211: Add a missing break in parse_station_flags Greg Kroah-Hartman
2018-09-03 16:48 ` [PATCH 3.18 07/56] scsi: libiscsi: fix possible NULL pointer dereference in case of TMF Greg Kroah-Hartman
2018-09-03 16:48 ` [PATCH 3.18 08/56] drm/imx: imx-ldb: disable LDB on driver bind Greg Kroah-Hartman
2018-09-03 16:48 ` [PATCH 3.18 09/56] drm/imx: imx-ldb: check if channel is enabled before printing warning Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 10/56] usb: gadget: r8a66597: Fix two possible sleep-in-atomic-context bugs in init_controller() Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 11/56] usb: gadget: r8a66597: Fix a possible sleep-in-atomic-context bugs in r8a66597_queue() Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 12/56] usb/phy: fix PPC64 build errors in phy-fsl-usb.c Greg Kroah-Hartman
2018-09-03 16:49   ` [3.18,12/56] " Greg Kroah-Hartman
2018-09-03 16:49 ` Greg Kroah-Hartman [this message]
2018-09-03 16:49 ` [PATCH 3.18 15/56] tools/power turbostat: fix -S on UP systems Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 16/56] net: caif: Add a missing rcu_read_unlock() in caif_flow_cb Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 17/56] atl1c: reserve min skb headroom Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 18/56] can: mpc5xxx_can: check of_iomap return before use Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 19/56] media: staging: omap4iss: Include asm/cacheflush.h after generic includes Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 20/56] bnx2x: Fix invalid memory access in rss hash config path Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 21/56] net: axienet: Fix double deregister of mdio Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 22/56] fscache: Allow cancelled operations to be enqueued Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 23/56] cachefiles: Fix refcounting bug in backing-file read monitoring Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 24/56] cachefiles: Wait rather than BUGing on "Unexpected object collision" Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 25/56] selftests/ftrace: Add snapshot and tracing_on test case Greg Kroah-Hartman
2018-09-03 16:49   ` Greg Kroah-Hartman
2018-09-03 16:49   ` gregkh
2018-09-03 16:49 ` [PATCH 3.18 26/56] zswap: re-check zswap_is_full() after do zswap_shrink() Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 27/56] tools/power turbostat: Read extended processor family from CPUID Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 28/56] Revert "MIPS: BCM47XX: Enable 74K Core ExternalSync for PCIe erratum" Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 29/56] enic: handle mtu change for vf properly Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 30/56] arc: fix build errors in arc/include/asm/delay.h Greg Kroah-Hartman
2018-09-03 16:49   ` Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 31/56] arc: fix type warnings in arc/mm/cache.c Greg Kroah-Hartman
2018-09-03 16:49   ` Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 32/56] drivers: net: lmc: fix case value for target abort error Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 33/56] scsi: fcoe: drop frames in ELS LOGO error path Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 34/56] scsi: vmw_pvscsi: Return DID_RESET for status SAM_STAT_COMMAND_TERMINATED Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 35/56] mm/memory.c: check return value of ioremap_prot Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 36/56] btrfs: dont leak ret from do_chunk_alloc Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 37/56] s390/kvm: fix deadlock when killed by oom Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 38/56] ext4: reset error code in ext4_find_entry in fallback Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 39/56] arm64: mm: check for upper PAGE_SHIFT bits in pfn_valid() Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 40/56] KVM: arm/arm64: Skip updating PTE entry if no change Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 41/56] KVM: arm/arm64: Skip updating PMD " Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 42/56] x86/process: Re-export start_thread() Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 43/56] fuse: Dont access pipe->buffers without pipe_lock() Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 44/56] fuse: Add missed unlock_page() to fuse_readpages_fill() Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 45/56] udl-kms: change down_interruptible to down Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 46/56] udl-kms: handle allocation failure Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 47/56] udl-kms: fix crash due to uninitialized memory Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 48/56] ASoC: sirf: Fix potential NULL pointer dereference Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 50/56] s390/qdio: reset old sbal_state flags Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 51/56] s390/pci: fix out of bounds access during irq setup Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 52/56] kprobes: Make list and blacklist root user read only Greg Kroah-Hartman
2018-09-03 16:49   ` Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 53/56] MIPS: Correct the 64-bit DSP accumulator register size Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 54/56] scsi: sysfs: Introduce sysfs_{un,}break_active_protection() Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 55/56] scsi: core: Avoid that SCSI device removal through sysfs triggers a deadlock Greg Kroah-Hartman
2018-09-03 16:49 ` [PATCH 3.18 56/56] cdrom: Fix info leak/OOB read in cdrom_ioctl_drive_status Greg Kroah-Hartman
2018-09-04  0:42 ` [PATCH 3.18 00/56] 3.18.121-stable review Nathan Chancellor
2018-09-04 19:20 ` Shuah Khan
2018-09-04 22:50 ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180903164924.813770576@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=alexander.levin@microsoft.com \
    --cc=erosca@de.adit-jv.com \
    --cc=felipe.balbi@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ruslan.bilovol@gmail.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.