can: skb: drop tx skb if in listen only mode
authorVincent Mailhol <mailhol.vincent@wanadoo.fr>
Fri, 10 Jun 2022 14:30:09 +0000 (23:30 +0900)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Sat, 11 Jun 2022 15:11:02 +0000 (17:11 +0200)
commita6d190f8c7670068d8c154ef8477eca07b5e3574
tree4271015a286269a3c526c3b71e9d2855e6c3546b
parentccd8a9351f7b44bc1c0c8e4d39c0d6593b106fc4
can: skb: drop tx skb if in listen only mode

Frames can be directly injected to a can driver via the packet
socket. By doing so, it is possible to reach the
net_device_ops::ndo_start_xmit function even if the driver is
configured in listen only mode.

Add a check in can_dropped_invalid_skb() to discard the skb if
CAN_CTRLMODE_LISTENONLY is set.

Link: https://lore.kernel.org/all/20220610143009.323579-8-mailhol.vincent@wanadoo.fr
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Acked-by: Max Staudt <max@enpas.org>
Tested-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/dev/skb.c