]> git.baikalelectronics.ru Git - kernel.git/commit
can: isotp: convert struct tpcon::{idx,len} to unsigned int
authorMarc Kleine-Budde <mkl@pengutronix.de>
Wed, 5 Jan 2022 13:01:12 +0000 (14:01 +0100)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Wed, 5 Jan 2022 20:49:47 +0000 (21:49 +0100)
commitd3c0f858b39a5b1e24d3335107e2ec4469aa101c
tree73823b454d66df7ecec4f32111df2905e5ec3528
parentd5536667142d90bc874d7714104847e2e7f7d1b5
can: isotp: convert struct tpcon::{idx,len} to unsigned int

In isotp_rcv_ff() 32 bit of data received over the network is assigned
to struct tpcon::len. Later in that function the length is checked for
the maximal supported length against MAX_MSG_LENGTH.

As struct tpcon::len is an "int" this check does not work, if the
provided length overflows the "int".

Later on struct tpcon::idx is compared against struct tpcon::len.

To fix this problem this patch converts both struct tpcon::{idx,len}
to unsigned int.

Fixes: 28da5a05c8c3 ("can: add ISO 15765-2:2016 transport protocol")
Link: https://lore.kernel.org/all/20220105132429.1170627-1-mkl@pengutronix.de
Cc: stable@vger.kernel.org
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Reported-by: syzbot+4c63f36709a642f801c5@syzkaller.appspotmail.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
net/can/isotp.c