Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 31e5d4ab authored by Brian Niebuhr's avatar Brian Niebuhr Committed by Greg Kroah-Hartman
Browse files

USB: gadget: fix EEM gadget CRC usage



eem_wrap() is sending a sentinel CRC, but it didn't indicate that to
the host, it should zero bit 14 (bmCRC) in the EEM packet header,
instead of setting it.

Also remove a redundant crc calculation in eem_unwrap().


Signed-off-by: default avatarSteve Longerbeam <stevel@netspectrum.com>
Acked-by: default avatarBrian Niebuhr <bniebuhr@efjohnson.com>
Acked-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent dd091c7b
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -358,7 +358,7 @@ static struct sk_buff *eem_wrap(struct gether *port, struct sk_buff *skb)
	 * b15:		bmType (0 == data)
	 * b15:		bmType (0 == data)
	 */
	 */
	len = skb->len;
	len = skb->len;
	put_unaligned_le16((len & 0x3FFF) | BIT(14), skb_push(skb, 2));
	put_unaligned_le16(len & 0x3FFF, skb_push(skb, 2));


	/* add a zero-length EEM packet, if needed */
	/* add a zero-length EEM packet, if needed */
	if (padlen)
	if (padlen)
@@ -464,7 +464,6 @@ static int eem_unwrap(struct gether *port,
			}
			}


			/* validate CRC */
			/* validate CRC */
			crc = get_unaligned_le32(skb->data + len - ETH_FCS_LEN);
			if (header & BIT(14)) {
			if (header & BIT(14)) {
				crc = get_unaligned_le32(skb->data + len
				crc = get_unaligned_le32(skb->data + len
							- ETH_FCS_LEN);
							- ETH_FCS_LEN);