Skip to content

Commit b312dbd

Browse files
committed
can: isotp: tx-path: zero initialize outgoing CAN frames
Commit d4eb538e1f48 ("can: isotp: TX-path: ensure that CAN frame flags are initialized") ensured the TX flags to be properly set for outgoing CAN frames. In fact the root cause of the issue results from a missing initialization of outgoing CAN frames created by isotp. This is no problem on the CAN bus as the CAN driver only picks the correctly defined content from the struct can(fd)_frame. But when the outgoing frames are monitored (e.g. with candump) we potentially leak some bytes in the unused content of struct can(fd)_frame. Fixes: e057dd3fc20f ("can: add ISO 15765-2:2016 transport protocol") Cc: Marc Kleine-Budde <[email protected]> Signed-off-by: Oliver Hartkopp <[email protected]>
1 parent 9c719c5 commit b312dbd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/can/isotp.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ static int isotp_send_fc(struct sock *sk, int ae, u8 flowstatus)
231231
isotp_skb_set_owner(nskb, sk);
232232
ncf = (struct canfd_frame *) nskb->data;
233233
skb_put(nskb, so->ll.mtu);
234+
memset(ncf, 0, so->ll.mtu);
234235

235236
/* create & send flow control reply */
236237
ncf->can_id = so->txid;
@@ -789,6 +790,7 @@ static void isotp_tx_timer_tsklet(unsigned long data)
789790
isotp_skb_reserve(skb, dev);
790791
cf = (struct canfd_frame *)skb->data;
791792
skb_put(skb, so->ll.mtu);
793+
memset(cf, 0, so->ll.mtu);
792794

793795
/* create consecutive frame */
794796
isotp_fill_dataframe(cf, so, ae, 0);
@@ -921,6 +923,7 @@ static int isotp_sendmsg(struct kiocb *iocb, struct socket *sock,
921923

922924
cf = (struct canfd_frame *)skb->data;
923925
skb_put(skb, so->ll.mtu);
926+
memset(cf, 0, so->ll.mtu);
924927

925928
/* check for single frame transmission depending on TX_DL */
926929
if (size <= so->tx.ll_dl - SF_PCI_SZ4 - ae - off) {

0 commit comments

Comments
 (0)