* [PATCH] can: j1939: fix missing CAN header initialization
@ 2022-11-04 7:50 Oliver Hartkopp
2022-11-04 12:04 ` Marc Kleine-Budde
0 siblings, 1 reply; 2+ messages in thread
From: Oliver Hartkopp @ 2022-11-04 7:50 UTC (permalink / raw)
To: netdev, linux-can, linux-kernel
Cc: Oliver Hartkopp, Oleksij Rempel, syzbot+d168ec0caca4697e03b1
The read access to struct canxl_frame::len inside of a j1939 created skbuff
revealed a missing initialization of reserved and later filled elements in
struct can_frame.
This patch initializes the 8 byte CAN header with zero.
Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol")
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/linux-can/20221104052235.GA6474@pengutronix.de/T/#t
Reported-by: syzbot+d168ec0caca4697e03b1@syzkaller.appspotmail.com
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
---
net/can/j1939/main.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/can/j1939/main.c b/net/can/j1939/main.c
index 144c86b0e3ff..821d4ff303b3 100644
--- a/net/can/j1939/main.c
+++ b/net/can/j1939/main.c
@@ -334,10 +334,13 @@ int j1939_send_one(struct j1939_priv *priv, struct sk_buff *skb)
dlc = skb->len;
/* re-claim the CAN_HDR from the SKB */
cf = skb_push(skb, J1939_CAN_HDR);
+ /* initialize header structure */
+ memset(cf, 0, J1939_CAN_HDR);
+
/* make it a full can frame again */
skb_put(skb, J1939_CAN_FTR + (8 - dlc));
canid = CAN_EFF_FLAG |
(skcb->priority << 26) |
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] can: j1939: fix missing CAN header initialization
2022-11-04 7:50 [PATCH] can: j1939: fix missing CAN header initialization Oliver Hartkopp
@ 2022-11-04 12:04 ` Marc Kleine-Budde
0 siblings, 0 replies; 2+ messages in thread
From: Marc Kleine-Budde @ 2022-11-04 12:04 UTC (permalink / raw)
To: Oliver Hartkopp
Cc: netdev, linux-can, linux-kernel, Oleksij Rempel,
syzbot+d168ec0caca4697e03b1
[-- Attachment #1: Type: text/plain, Size: 953 bytes --]
On 04.11.2022 08:50:00, Oliver Hartkopp wrote:
> The read access to struct canxl_frame::len inside of a j1939 created skbuff
> revealed a missing initialization of reserved and later filled elements in
> struct can_frame.
>
> This patch initializes the 8 byte CAN header with zero.
>
> Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol")
> Cc: Oleksij Rempel <o.rempel@pengutronix.de>
> Link: https://lore.kernel.org/linux-can/20221104052235.GA6474@pengutronix.de/T/#t
> Reported-by: syzbot+d168ec0caca4697e03b1@syzkaller.appspotmail.com
> Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Applied to linux-can + add stable on Cc.
Thanks,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-04 12:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-04 7:50 [PATCH] can: j1939: fix missing CAN header initialization Oliver Hartkopp
2022-11-04 12:04 ` Marc Kleine-Budde
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.