USB: gadget eth: Fix calculate CRC32 in EEM
authorJiri Pinkava <jiri.pinkava@vscht.cz>
Sun, 20 Jun 2010 18:05:52 +0000 (20:05 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 30 Jun 2010 15:16:06 +0000 (08:16 -0700)
CRC should be calculated for Ethernet frame, not for whole recievede EEM data.
This bug shows rarely, because in many times len == skb->len.

Signed-off-by: Jiri Pinkava <jiri.pinkava@vscht.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/gadget/f_eem.c

index 38226e9a371d2d39dcb932a64144372545e75542..95dd4662d6a83acb3153433713c3e48889500f69 100644 (file)
@@ -469,8 +469,7 @@ static int eem_unwrap(struct gether *port,
                                crc = get_unaligned_le32(skb->data + len
                                                        - ETH_FCS_LEN);
                                crc2 = ~crc32_le(~0,
-                                               skb->data,
-                                               skb->len - ETH_FCS_LEN);
+                                               skb->data, len - ETH_FCS_LEN);
                        } else {
                                crc = get_unaligned_be32(skb->data + len
                                                        - ETH_FCS_LEN);