]> git.itanic.dy.fi Git - linux-stable/commitdiff
can: esd_usb2: Fix can_dlc value for received RTR, frames
authorStefan Mätje <Stefan.Maetje@esd.eu>
Wed, 18 Oct 2017 11:25:17 +0000 (13:25 +0200)
committerSasha Levin <alexander.levin@verizon.com>
Mon, 6 Nov 2017 04:54:35 +0000 (23:54 -0500)
[ Upstream commit 72d92e865d1560723e1957ee3f393688c49ca5bf ]

The dlc member of the struct rx_msg contains also the ESD_RTR flag to
mark received RTR frames. Without the fix the can_dlc value for received
RTR frames would always be set to 8 by get_can_dlc() instead of the
received value.

Fixes: 96d8e90382dc ("can: Add driver for esd CAN-USB/2 device")
Signed-off-by: Stefan Mätje <stefan.maetje@esd.eu>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
drivers/net/can/usb/esd_usb2.c

index 411c1af92c62c1c93985e4adf7232d1b6b78d8bc..730a2bac124d018aeb7adcc822f82c6f9d32d5d4 100644 (file)
@@ -335,7 +335,7 @@ static void esd_usb2_rx_can_msg(struct esd_usb2_net_priv *priv,
                }
 
                cf->can_id = id & ESD_IDMASK;
-               cf->can_dlc = get_can_dlc(msg->msg.rx.dlc);
+               cf->can_dlc = get_can_dlc(msg->msg.rx.dlc & ~ESD_RTR);
 
                if (id & ESD_EXTID)
                        cf->can_id |= CAN_EFF_FLAG;