Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp1159081rdb; Sat, 9 Sep 2023 11:21:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGL5URQkiOfXBOYcwguWQ3inCPbx9aDLkVYhRsMZ8xyiOx/pVl/3VGPFem3nulKozjd6qwX X-Received: by 2002:a17:902:da92:b0:1c0:ceab:e9bd with SMTP id j18-20020a170902da9200b001c0ceabe9bdmr7410653plx.25.1694283687088; Sat, 09 Sep 2023 11:21:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694283687; cv=none; d=google.com; s=arc-20160816; b=m60104VU5EuCpmyd/7XvU0DhR7aAD+mchHgliMxtJsw4btvbYqr5gCesINyAcCXHme u+cdG347qCJlPmN9NcUk+cG1MxyYy5dBzaw0Bc11DHFqschPbh42jqOtN6pP3JOlnOsu r34hYBKkZd7W3eO6Ti80eFc+IDsKAnmashUBhbpzm0jY7g3Y4+V7x8szMjB00dy3rmcg +qQEKCp8p37e0wAWXrrCyH0QDUFxlElqN31SiGMMoQq+uO3zE1vl7oiVkPbcjnjZJdSC NvNVlQ8Dr8u5Yoifq1ansfD1vsolNxd+ykcB6Tqhz+9y9WKqKoEsTYCJg26u6l0GhkhF CZ6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject; bh=cc9y6fShOq/gOw8igzwa7Ly0yN+TV4kDtPrM3MOSyn0=; fh=aL3qB3CZp7jm0iUaEfDXdXHfgCgueU8KH1PqrMUJRsk=; b=TAyKO2ZNfZuuTvjlmV0DtcGc48vcFQeh3tQ1P1OKbDh5WEp0Bv4ubdVPKmM6jhCO+q Gg7ldrOoFJ6IJAd4F7Yop7hkRQLtbVzSJuW5oiqNlbpUwkF/s36AWKk1J9RnLYF3TAhz BlaNobHv31xhPLzxu0OxhYo5hHn0v6xu1E+35+xxEToTrUm7E5z386jcqmWVbOM2CCRO wDSpLYGyTVij7FFlF1FBZI8RH+bl7XnohMEiJFecBAYh6s78iUiJFPHN2/5wcGs3xMRE Ne/X9LEZ2H+0LZ4CLfucSFEikQ4FHj17NzC5GdkFLL4FW2wfh9l4LqEXDG64gkbnQV85 8b0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f4-20020a170902ce8400b001bf01c6bc1bsi3594499plg.551.2023.09.09.11.21.11; Sat, 09 Sep 2023 11:21:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240258AbjIIJRu (ORCPT + 99 others); Sat, 9 Sep 2023 05:17:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229957AbjIIJRt (ORCPT ); Sat, 9 Sep 2023 05:17:49 -0400 Received: from mx01.omp.ru (mx01.omp.ru [90.154.21.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADE41186; Sat, 9 Sep 2023 02:17:44 -0700 (PDT) Received: from [192.168.1.103] (178.176.75.159) by msexch01.omp.ru (10.188.4.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.986.14; Sat, 9 Sep 2023 12:17:37 +0300 Subject: Re: [PATCH AUTOSEL 5.15 11/19] usb: gadget: fsl_qe_udc: validate endpoint index for ch9 udc To: Sasha Levin , , CC: Ma Ke , Li Yang , Greg Kroah-Hartman , , References: <20230909003903.3580394-1-sashal@kernel.org> <20230909003903.3580394-11-sashal@kernel.org> From: Sergey Shtylyov Organization: Open Mobile Platform Message-ID: <7d29c746-91ed-1559-6d48-855791d19e76@omp.ru> Date: Sat, 9 Sep 2023 12:17:37 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20230909003903.3580394-11-sashal@kernel.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [178.176.75.159] X-ClientProxiedBy: msexch01.omp.ru (10.188.4.12) To msexch01.omp.ru (10.188.4.12) X-KSE-ServerInfo: msexch01.omp.ru, 9 X-KSE-AntiSpam-Interceptor-Info: scan successful X-KSE-AntiSpam-Version: 5.9.59, Database issued on: 09/09/2023 08:59:14 X-KSE-AntiSpam-Status: KAS_STATUS_NOT_DETECTED X-KSE-AntiSpam-Method: none X-KSE-AntiSpam-Rate: 59 X-KSE-AntiSpam-Info: Lua profiles 179760 [Sep 08 2023] X-KSE-AntiSpam-Info: Version: 5.9.59.0 X-KSE-AntiSpam-Info: Envelope from: s.shtylyov@omp.ru X-KSE-AntiSpam-Info: LuaCore: 530 530 ecb1547b3f72d1df4c71c0b60e67ba6b4aea5432 X-KSE-AntiSpam-Info: {rep_avail} X-KSE-AntiSpam-Info: {Tracking_uf_ne_domains} X-KSE-AntiSpam-Info: {Tracking_from_domain_doesnt_match_to} X-KSE-AntiSpam-Info: {relay has no DNS name} X-KSE-AntiSpam-Info: {SMTP from is not routable} X-KSE-AntiSpam-Info: {Found in DNSBL: 178.176.75.159 in (user) b.barracudacentral.org} X-KSE-AntiSpam-Info: 127.0.0.199:7.1.2;lore.kernel.org:7.1.1;omp.ru:7.1.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;178.176.75.159:7.7.3,7.1.2,7.4.1 X-KSE-AntiSpam-Info: {cloud_iprep_silent} X-KSE-AntiSpam-Info: FromAlignment: s X-KSE-AntiSpam-Info: {rdns complete} X-KSE-AntiSpam-Info: {fromrtbl complete} X-KSE-AntiSpam-Info: ApMailHostAddress: 178.176.75.159 X-KSE-AntiSpam-Info: Rate: 59 X-KSE-AntiSpam-Info: Status: not_detected X-KSE-AntiSpam-Info: Method: none X-KSE-AntiSpam-Info: Auth:dmarc=none header.from=omp.ru;spf=none smtp.mailfrom=omp.ru;dkim=none X-KSE-Antiphishing-Info: Clean X-KSE-Antiphishing-ScanningType: Heuristic X-KSE-Antiphishing-Method: None X-KSE-Antiphishing-Bases: 09/09/2023 09:03:00 X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: Clean, bases: 9/9/2023 1:20:00 AM X-KSE-Attachment-Filter-Triggered-Rules: Clean X-KSE-Attachment-Filter-Triggered-Filters: Clean X-KSE-BulkMessagesFiltering-Scan-Result: InTheLimit X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 On 9/9/23 3:38 AM, Sasha Levin wrote: > From: Ma Ke > > [ Upstream commit ce9daa2efc0872a9a68ea51dc8000df05893ef2e ] > > We should verify the bound of the array to assure that host > may not manipulate the index to point past endpoint array. > > Signed-off-by: Ma Ke > Acked-by: Li Yang > Link: https://lore.kernel.org/r/20230628081511.186850-1-make_ruc2021@163.com > Signed-off-by: Greg Kroah-Hartman > Signed-off-by: Sasha Levin > --- > drivers/usb/gadget/udc/fsl_qe_udc.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c b/drivers/usb/gadget/udc/fsl_qe_udc.c > index 15db7a3868fe4..aff4050f96dd6 100644 > --- a/drivers/usb/gadget/udc/fsl_qe_udc.c > +++ b/drivers/usb/gadget/udc/fsl_qe_udc.c > @@ -1956,6 +1956,8 @@ static void ch9getstatus(struct qe_udc *udc, u8 request_type, u16 value, > } else if ((request_type & USB_RECIP_MASK) == USB_RECIP_ENDPOINT) { > /* Get endpoint status */ > int pipe = index & USB_ENDPOINT_NUMBER_MASK; > + if (pipe >= USB_MAX_ENDPOINTS) > + goto stall; Hm, what's the earliest version of gcc needed to compile this (*if* statement amongst the variable declarations)? > struct qe_ep *target_ep = &udc->eps[pipe]; > u16 usep; > MBR, Sergey