1
0
Fork 0
alistair23-linux/drivers/net/can/usb
Marc Kleine-Budde 405fd21805 can: gs_usb: fix endianess problem with candleLight firmware
[ Upstream commit 4ba1cb39fc ]

The firmware on the original USB2CAN by Geschwister Schneider Technologie
Entwicklungs- und Vertriebs UG exchanges all data between the host and the
device in host byte order. This is done with the struct
gs_host_config::byte_order member, which is sent first to indicate the desired
byte order.

The widely used open source firmware candleLight doesn't support this feature
and exchanges the data in little endian byte order. This breaks if a device
with candleLight firmware is used on big endianess systems.

To fix this problem, all u32 (but not the struct gs_host_frame::echo_id, which
is a transparent cookie) are converted to __le32.

Cc: Maximilian Schneider <max@schneidersoft.net>
Cc: Hubert Denkmair <hubert@denkmair.de>
Reported-by: Michael Rausch <mr@netadair.de>
Link: https://lore.kernel.org/r/b58aace7-61f3-6df7-c6df-69fee2c66906@netadair.de
Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>
Fixes: d08e973a77 ("can: gs_usb: Added support for the GS_USB CAN devices")
Link: https://lore.kernel.org/r/20201120103818.3386964-1-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-12-02 08:49:53 +01:00
..
kvaser_usb can: kvaser_usb: kvaser_usb_hydra: Fix KCAN bittiming limits 2020-11-24 13:29:17 +01:00
peak_usb can: peak_usb: fix potential integer overflow on shift of a int 2020-11-24 13:29:06 +01:00
Kconfig drivers: net: Fix Kconfig indentation 2019-09-26 08:56:17 +02:00
Makefile can: kvaser_usb: Split driver into kvaser_usb_core.c and kvaser_usb_leaf.c 2018-07-27 10:40:19 +02:00
ems_usb.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 164 2019-05-30 11:26:38 -07:00
esd_usb2.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 164 2019-05-30 11:26:38 -07:00
gs_usb.c can: gs_usb: fix endianess problem with candleLight firmware 2020-12-02 08:49:53 +01:00
mcba_usb.c can: mcba_usb: mcba_usb_start_xmit(): first fill skb, then pass to can_put_echo_skb() 2020-11-24 13:29:06 +01:00
ucan.c can: ucan: fix non-atomic allocation in completion handler 2019-12-13 08:43:16 +01:00
usb_8dev.c can: usb_8dev: fix use-after-free on disconnect 2019-11-04 21:47:20 +01:00