aboutsummaryrefslogtreecommitdiffstats
path: root/net/can/j1939
diff options
context:
space:
mode:
authorOliver Hartkopp <socketcan@hartkopp.net>2022-09-12 19:07:19 +0200
committerMarc Kleine-Budde <mkl@pengutronix.de>2022-09-15 09:08:08 +0200
commit96a7457a14d9cf98cf58de1e26c03180e0f28141 (patch)
tree76f566fef2733a820118b89fe7a7dbd504644903 /net/can/j1939
parentcan: flexcan: Switch to use dev_err_probe() helper (diff)
downloadlinux-dev-96a7457a14d9cf98cf58de1e26c03180e0f28141.tar.xz
linux-dev-96a7457a14d9cf98cf58de1e26c03180e0f28141.zip
can: skb: unify skb CAN frame identification helpers
Replace open coded checks for sk_buffs containing Classical CAN and CAN FD frame structures as a preparation for CAN XL support. With the added length check the unintended processing of CAN XL frames having the CANXL_XLF bit set can be suppressed even when the skb->len fits to non CAN XL frames. The CAN_RAW socket needs a rework to use these helpers. Therefore the use of these helpers is postponed to the CAN_RAW CAN XL integration. The J1939 protocol gets a check for Classical CAN frames too. Acked-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net> Link: https://lore.kernel.org/all/20220912170725.120748-2-socketcan@hartkopp.net Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'net/can/j1939')
-rw-r--r--net/can/j1939/main.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/can/j1939/main.c b/net/can/j1939/main.c
index 8452b0fbb78c..144c86b0e3ff 100644
--- a/net/can/j1939/main.c
+++ b/net/can/j1939/main.c
@@ -42,6 +42,10 @@ static void j1939_can_recv(struct sk_buff *iskb, void *data)
struct j1939_sk_buff_cb *skcb, *iskcb;
struct can_frame *cf;
+ /* make sure we only get Classical CAN frames */
+ if (!can_is_can_skb(iskb))
+ return;
+
/* create a copy of the skb
* j1939 only delivers the real data bytes,
* the header goes into sockaddr.