From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A014C433F5 for ; Fri, 14 Jan 2022 08:19:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239816AbiANITd (ORCPT ); Fri, 14 Jan 2022 03:19:33 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58226 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237179AbiANISy (ORCPT ); Fri, 14 Jan 2022 03:18:54 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A4D2E61E06; Fri, 14 Jan 2022 08:18:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E829C36AEA; Fri, 14 Jan 2022 08:18:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1642148333; bh=PWIEp0SwuyloDQYdOwsvlH39NhqCKMKAkhMQuOyesRg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bNIIH/hruYxcjH8UbMbV3imbNmjWDqQdADfnVpAxKLPxqHGOuuKx+qVm8L7tNLNU8 g8ze3nrVQTfji1EU/w36WZbDG//0PrTRxSZQPqnkY9BQBNGw2yABsCcP0sX96sMKPI jHnYnYmDtY3I7yGQrk2QGjvzdSF4f07556A5M5SY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oliver Hartkopp , syzbot+4c63f36709a642f801c5@syzkaller.appspotmail.com, Marc Kleine-Budde Subject: [PATCH 5.10 17/25] can: isotp: convert struct tpcon::{idx,len} to unsigned int Date: Fri, 14 Jan 2022 09:16:25 +0100 Message-Id: <20220114081543.288480718@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220114081542.698002137@linuxfoundation.org> References: <20220114081542.698002137@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marc Kleine-Budde commit 5f33a09e769a9da0482f20a6770a342842443776 upstream. 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: e057dd3fc20f ("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 Reported-by: syzbot+4c63f36709a642f801c5@syzkaller.appspotmail.com Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- net/can/isotp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/can/isotp.c +++ b/net/can/isotp.c @@ -119,8 +119,8 @@ enum { }; struct tpcon { - int idx; - int len; + unsigned int idx; + unsigned int len; u32 state; u8 bs; u8 sn;