android_kernel_motorola_sm6375/net/can
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Oleksij Rempel d2136f0569 can: j1939: j1939_tp_tx_dat_new(): fix out-of-bounds memory access
commit b45193cb4df556fe6251b285a5ce44046dd36b4a upstream.

In the j1939_tp_tx_dat_new() function, an out-of-bounds memory access
could occur during the memcpy() operation if the size of skb->cb is
larger than the size of struct j1939_sk_buff_cb. This is because the
memcpy() operation uses the size of skb->cb, leading to a read beyond
the struct j1939_sk_buff_cb.

Updated the memcpy() operation to use the size of struct
j1939_sk_buff_cb instead of the size of skb->cb. This ensures that the
memcpy() operation only reads the memory within the bounds of struct
j1939_sk_buff_cb, preventing out-of-bounds memory access.

Additionally, add a BUILD_BUG_ON() to check that the size of skb->cb
is greater than or equal to the size of struct j1939_sk_buff_cb. This
ensures that the skb->cb buffer is large enough to hold the
j1939_sk_buff_cb structure.

Fixes: 9d71dd0c70 ("can: add support of SAE J1939 protocol")
Reported-by: Shuangpeng Bai <[email protected]>
Tested-by: Shuangpeng Bai <[email protected]>
Signed-off-by: Oleksij Rempel <[email protected]>
Link: https://groups.google.com/g/syzkaller/c/G_LL-C3plRs/m/-8xCi6dCAgAJ
Link: https://lore.kernel.org/all/[email protected]
Cc: [email protected]
[mkl: rephrase commit message]
Signed-off-by: Marc Kleine-Budde <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2023-04-20 12:07:34 +02:00
..
j1939 can: j1939: j1939_tp_tx_dat_new(): fix out-of-bounds memory access 2023-04-20 12:07:34 +02:00
af_can.c can: af_can: fix NULL pointer dereference in can_rcv_filter 2022-12-14 11:30:44 +01:00
af_can.h
bcm.c can: bcm: bcm_tx_setup(): fix KMSAN uninit-value in vfs_write 2023-04-05 11:16:44 +02:00
gw.c can: gw: synchronize rcu operations before removing gw job entry 2021-07-14 16:53:04 +02:00
Kconfig
Makefile
proc.c
raw.c can: raw: raw_setsockopt(): fix raw_rcv panic for sock UAF 2021-08-04 12:27:38 +02:00