Re: [PATCH] Fix CDC EEM host driver 'sentinel' CRC validation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 10, 2009 at 8:21 AM, Brian Niebuhr<bniebuhr3@xxxxxxxxx> wrote:
> CDC EEM allows using a 'sentinel' ethernet frame CRC of 0xdeadbeef in place of a real CRC.  In this driver the ethernet frame CRC is read as a little-endian value, but the 'sentinel' CRC value is actually big-endian.  Therefore, if the 'sentinel' CRC option is being used, the CRC value read from the frame must be compared against a byte-reversed 0xdeadbeef.
>
> Signed-off-by: Brian Niebuhr <bniebuhr@xxxxxxxxxxxxx>
> ---
>  drivers/net/usb/cdc_eem.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c
> index 45cebfb..9917b60 100644
> --- a/drivers/net/usb/cdc_eem.c
> +++ b/drivers/net/usb/cdc_eem.c
> @@ -313,7 +313,7 @@ static int eem_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
>                        if (header & BIT(14))
>                                crc2 = ~crc32_le(~0, skb2->data, skb2->len);
>                        else
> -                               crc2 = 0xdeadbeef;
> +                               crc2 = 0xefbeadde; /* 0xdeadbeef */
>
>                        if (is_last)
>                                return crc == crc2;
Hi Brian,

This will not work correctly on big-endian cpus like a MIPS or PPC. I
suggest something like:

crc2 = cpu_to_be32(0xdeadbeef);

Regards, Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux