aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb
diff options
context:
space:
mode:
authorBrian Niebuhr <bniebuhr@efjohnson.com>2009-08-10 17:46:59 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-09-23 09:46:34 -0400
commit9ca33a0f1abdefea3811666d9e87af11fd0af6c6 (patch)
treebba1cc2692b38f9a3d76d16910d9575d1d5b0960 /drivers/net/usb
parent5429c7316577fcd859f6b53e10884bb8e1e3bcef (diff)
USB: Fix CDC EEM host driver 'sentinel' CRC validation
This is an alternate solution to the EEM 'sentinel' CRC valiation issue. CDC EEM allows using a 'sentinel' ethernet frame CRC of 0xdeadbeef in place of a real CRC. The 'sentinel' value is transmitted in big-endian order whereas the normal CRC is little-endian. This patch handles both cases appropriately. Signed-off-by: Brian Niebuhr <bniebuhr@efjohnson.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r--drivers/net/usb/cdc_eem.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c
index 45cebfb302cf..23300656c266 100644
--- a/drivers/net/usb/cdc_eem.c
+++ b/drivers/net/usb/cdc_eem.c
@@ -300,20 +300,23 @@ static int eem_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
300 return 0; 300 return 0;
301 } 301 }
302 302
303 crc = get_unaligned_le32(skb2->data
304 + len - ETH_FCS_LEN);
305 skb_trim(skb2, len - ETH_FCS_LEN);
306
307 /* 303 /*
308 * The bmCRC helps to denote when the CRC field in 304 * The bmCRC helps to denote when the CRC field in
309 * the Ethernet frame contains a calculated CRC: 305 * the Ethernet frame contains a calculated CRC:
310 * bmCRC = 1 : CRC is calculated 306 * bmCRC = 1 : CRC is calculated
311 * bmCRC = 0 : CRC = 0xDEADBEEF 307 * bmCRC = 0 : CRC = 0xDEADBEEF
312 */ 308 */
313 if (header & BIT(14)) 309 if (header & BIT(14)) {
314 crc2 = ~crc32_le(~0, skb2->data, skb2->len); 310 crc = get_unaligned_le32(skb2->data
315 else 311 + len - ETH_FCS_LEN);
312 crc2 = ~crc32_le(~0, skb2->data, skb2->len
313 - ETH_FCS_LEN);
314 } else {
315 crc = get_unaligned_be32(skb2->data
316 + len - ETH_FCS_LEN);
316 crc2 = 0xdeadbeef; 317 crc2 = 0xdeadbeef;
318 }
319 skb_trim(skb2, len - ETH_FCS_LEN);
317 320
318 if (is_last) 321 if (is_last)
319 return crc == crc2; 322 return crc == crc2;