]> git.baikalelectronics.ru Git - kernel.git/commit
can: dev: __can_get_echo_skb(): fix bogous check for non-existing skb by removing it
authorManfred Schlaegl <manfred.schlaegl@ginzinger.com>
Wed, 19 Dec 2018 18:39:58 +0000 (19:39 +0100)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Tue, 22 Jan 2019 10:18:34 +0000 (11:18 +0100)
commit5ad65f0798a8adcbf0574a1c6f70eda4002c7867
tree750d2e28d6a9997c32f8712c7046604b33e5bcad
parent607d144b83b16847bc18fb058d4d51857c4ff9c6
can: dev: __can_get_echo_skb(): fix bogous check for non-existing skb by removing it

This patch revert commit bf96fe312f1c
("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: bf96fe312f1c ("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>
drivers/net/can/dev.c