linux-stable/include/linux/can
Oliver Hartkopp 386c49fe31 can: dev: fix skb drop check
commit ae64438be1 upstream.

In commit a6d190f8c7 ("can: skb: drop tx skb if in listen only
mode") the priv->ctrlmode element is read even on virtual CAN
interfaces that do not create the struct can_priv at startup. This
out-of-bounds read may lead to CAN frame drops for virtual CAN
interfaces like vcan and vxcan.

This patch mainly reverts the original commit and adds a new helper
for CAN interface drivers that provide the required information in
struct can_priv.

Fixes: a6d190f8c7 ("can: skb: drop tx skb if in listen only mode")
Reported-by: Dariusz Stojaczyk <Dariusz.Stojaczyk@opensynergy.com>
Cc: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Cc: Max Staudt <max@enpas.org>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Acked-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Link: https://lore.kernel.org/all/20221102095431.36831-1-socketcan@hartkopp.net
Cc: stable@vger.kernel.org # 6.0.x
[mkl: patch pch_can, too]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-11-16 10:04:12 +01:00
..
dev can: remove obsolete get_canfd_dlc() macro 2020-11-20 09:43:30 +01:00
platform can: flexcan: add platform data header 2021-07-25 11:36:29 +02:00
bittiming.h can: netlink: dump bitrate 0 if can_priv::bittiming.bitrate is -1U 2022-07-03 11:34:24 +02:00
can-ml.h net: introduce CAN specific pointer in the struct net_device 2021-02-24 14:32:15 -08:00
core.h can: remove obsolete version strings 2020-10-12 10:06:39 +02:00
dev.h can: dev: fix skb drop check 2022-11-16 10:04:12 +01:00
length.h can: length: can_skb_get_frame_len(): introduce function to get data length of frame in data link layer 2021-01-14 08:43:42 +01:00
rx-offload.h can: rx-offload: rename can_rx_offload_queue_sorted() -> can_rx_offload_queue_timestamp() 2022-04-19 16:58:04 +02:00
skb.h can: skb: move can_dropped_invalid_skb() and can_skb_headroom_valid() to skb.c 2022-06-11 17:11:02 +02:00