linux-stable/drivers/net/can
Manfred Schlaegl 69129bcefb can: dev: __can_get_echo_skb(): fix bogous check for non-existing skb by removing it
commit 7b12c8189a upstream.

This patch revert commit 7da11ba5c5
("can: dev: __can_get_echo_skb(): print error message, if trying to echo non existing skb")

After introduction of this change we encountered following new error
message on various i.MX plattforms (flexcan):

| flexcan 53fc8000.can can0: __can_get_echo_skb: BUG! Trying to echo non
| existing skb: can_priv::echo_skb[0]

The introduction of the message was a mistake because
priv->echo_skb[idx] = NULL is a perfectly valid in following case: If
CAN_RAW_LOOPBACK is disabled (setsockopt) in applications, the pkt_type
of the tx skb's given to can_put_echo_skb is set to PACKET_LOOPBACK. In
this case can_put_echo_skb will not set priv->echo_skb[idx]. It is
therefore kept NULL.

As additional argument for revert: The order of check and usage of idx
was changed. idx is used to access an array element before checking it's
boundaries.

Signed-off-by: Manfred Schlaegl <manfred.schlaegl@ginzinger.com>
Fixes: 7da11ba5c5 ("can: dev: __can_get_echo_skb(): print error message, if trying to echo non existing skb")
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-01-31 08:12:36 +01:00
..
c_can can: c_can: don't indicate triple sampling support for D_CAN 2017-11-15 15:53:20 +01:00
cc770 can: cc770: Fix use after free in cc770_tx_interrupt() 2018-03-28 18:39:24 +02:00
ifi_canfd can: ifi: Check core revision upon probe 2018-03-28 18:39:23 +02:00
m_can can: fix handling of unmodifiable configuration options 2016-05-09 11:07:28 +02:00
mscan can: mpc5xxx_can: check of_iomap return before use 2018-09-05 09:20:01 +02:00
rcar can: rcar_can: Fix erroneous registration 2018-12-13 09:20:25 +01:00
sja1000 can: sja1000: plx_pci: Add support for Moxa CAN devices 2016-10-31 20:48:19 +01:00
softing
spi can: mcp251x: add message about sucessful/unsuccessful probe 2016-06-23 11:23:49 +02:00
usb can: ems_usb: Fix memory leak on ems_usb_disconnect() 2018-08-06 16:23:03 +02:00
Kconfig can: rcar_can: Move Renesas CAN driver to rcar dir 2016-06-17 15:39:48 +02:00
Makefile can: rcar_can: Move Renesas CAN driver to rcar dir 2016-06-17 15:39:48 +02:00
at91_can.c can: at91_can: RX queue could get stuck at high bus load 2016-06-20 09:32:40 +02:00
bfin_can.c
dev.c can: dev: __can_get_echo_skb(): fix bogous check for non-existing skb by removing it 2019-01-31 08:12:36 +01:00
flexcan.c can: flex_can: Correct the checking for frame length in flexcan_start_xmit() 2018-03-03 10:23:27 +01:00
grcan.c
janz-ican3.c can: janz-ican3: error handling for CAL/CANopen firmware 2016-05-09 11:07:28 +02:00
led.c
pch_can.c
slcan.c can: slcan: Replace sizeof struct can_frame with CAN_MTU 2016-06-17 15:39:42 +02:00
sun4i_can.c can: sun4i: handle overrun in RX FIFO 2017-11-15 15:53:20 +01:00
ti_hecc.c can: ti_hecc: Fix napi poll return value for repoll 2017-12-14 09:28:09 +01:00
vcan.c
xilinx_can.c can: xilinx_can: fix RX overflow interrupt not being enabled 2018-07-28 07:49:13 +02:00