Skip to content

Commit

Permalink
can: isotp: convert struct tpcon::{idx,len} to unsigned int
Browse files Browse the repository at this point in the history
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: e057dd3 ("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>
  • Loading branch information
Marc Kleine-Budde committed Jan 5, 2022
1 parent 4a8737f commit 5f33a09
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/can/isotp.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ enum {
};

struct tpcon {
int idx;
int len;
unsigned int idx;
unsigned int len;
u32 state;
u8 bs;
u8 sn;
Expand Down

0 comments on commit 5f33a09

Please sign in to comment.