Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2300098pxp; Mon, 21 Mar 2022 16:16:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaLk4nh8rVhOO5fh8VKbTeI/pYmvA8rnK7YB0tD7TVjkuCUcgqZUVSssQtkcO2wb/+26hf X-Received: by 2002:a17:90a:4981:b0:1c6:b6dd:d7a9 with SMTP id d1-20020a17090a498100b001c6b6ddd7a9mr1621517pjh.22.1647904616913; Mon, 21 Mar 2022 16:16:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647904616; cv=none; d=google.com; s=arc-20160816; b=EDdI9l6zn9BUNKTrCo7UTUKMPHr6KkNBR0D0a2Gl6+5a+xKw+hYVtWRIVeaTiQcOWJ IR0y8yijA+BBVcrbSxdKxDKf5ItWKJ9V9aBO6nWnpikCuNP96Z3eH/WgydVGz0zFcmjF wyJCxKFBOhrDkUcggWXPd9YjxIUzS+8JEau8edvHnv7c1CvHOJWB//8H5WOI5/gwK4hl gjmW12m0Vt4e52sVPuVSVm7E4HZfyB/3JCA/81lO000Za9NmoPp36B01/i2l72DCcZP3 eNNHSZeKB/5zV16Y6pj85cG/8S3HDfiMEsehBKJ5HUaWkzSDty08ycWsWK1ML6yM5mnM EdxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kPEzusROtyBw8ODaQ95EoV9d1wSnOZeKVbktGGAByJo=; b=FohnbCt5uBho3U16S8GIjrBJohJ7vZqxPwwDQmdRPvlJwa6WPlkSDU2nOSXpUv+TM8 SHm8kiBqHMuFi90XtEeaKDk4i1RwJA21pX8ieiY8ZfJRhnp6JzoM77wRqJFex56s7rmB eAJI1ao0eNAMpsFhNw7rSg3WBsSQ6u4j72cBJoYXwsmbrMFENZ/6lYQpauNy0vseIrjf HLBDylxSr4Zq9qQc8aYdUga3XGygdjjz4Xm+pgZrEL36F3MKapF+hged6mYty/zK/++W ukMdVLehAZPHWHdPIHVQ5KKyVQWLAdrIR+p/GA+x+lmNt5zlOWDrZliyigh56e/9LX77 tuyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DFngkhzi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id t2-20020a056a00138200b004fa3a8dff73si9651571pfg.42.2022.03.21.16.16.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 16:16:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DFngkhzi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E16C4583B7; Mon, 21 Mar 2022 15:14:48 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348996AbiCUODO (ORCPT + 99 others); Mon, 21 Mar 2022 10:03:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349041AbiCUN6t (ORCPT ); Mon, 21 Mar 2022 09:58:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF5D91777F8; Mon, 21 Mar 2022 06:57:08 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id 9B1DBB81674; Mon, 21 Mar 2022 13:57:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15CF4C340F2; Mon, 21 Mar 2022 13:57:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871026; bh=JBwT2FpWuW+DXrzrhNxMCQ2pX1GZUCBphhPILV5OTbU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DFngkhzieF3ZQp/I5AMKG/rBhmzQC8G18SEAgLfv2z9CRALApJfQ3J6zelaGhC/tS U+4qmITblVukjv5B0bwgUEjIz/mLtF6tf4ZbQvdSVp3SfMiwl/qBlbW/BhfW6pBcz6 Q5l1Q7HNs21mT7aCQbSu5D1ugCUMo8cPPDNGRzPw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Dan Carpenter Subject: [PATCH 4.19 54/57] usb: gadget: rndis: prevent integer overflow in rndis_set_response() Date: Mon, 21 Mar 2022 14:52:35 +0100 Message-Id: <20220321133223.547619657@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133221.984120927@linuxfoundation.org> References: <20220321133221.984120927@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter commit 65f3324f4b6fed78b8761c3b74615ecf0ffa81fa upstream. If "BufOffset" is very large the "BufOffset + 8" operation can have an integer overflow. Cc: stable@kernel.org Fixes: 38ea1eac7d88 ("usb: gadget: rndis: check size of RNDIS_MSG_SET command") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/20220301080424.GA17208@kili Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/function/rndis.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/usb/gadget/function/rndis.c +++ b/drivers/usb/gadget/function/rndis.c @@ -640,6 +640,7 @@ static int rndis_set_response(struct rnd BufLength = le32_to_cpu(buf->InformationBufferLength); BufOffset = le32_to_cpu(buf->InformationBufferOffset); if ((BufLength > RNDIS_MAX_TOTAL_SIZE) || + (BufOffset > RNDIS_MAX_TOTAL_SIZE) || (BufOffset + 8 >= RNDIS_MAX_TOTAL_SIZE)) return -EINVAL;