Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp15681514rwd; Sun, 25 Jun 2023 23:06:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5h2vFO2f1qnPEcG3+a9ranlPgb9UJr7++CCdOBXcjpA06fzIlh6nNWhaHRNVTDhnu7KKcb X-Received: by 2002:a05:620a:2a57:b0:765:9925:23db with SMTP id q23-20020a05620a2a5700b00765992523dbmr3766032qkp.73.1687759592911; Sun, 25 Jun 2023 23:06:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687759592; cv=none; d=google.com; s=arc-20160816; b=PjgWELIr/dlQY5Z5aBN0+B5ZLSWw8HMGUYh0/t6at3+OvEHZeEtKfQpB5B7rQqXBq8 NaL96/Mp4+EDAat83MGJneIh5I5USeRCHRTyvaAE4o2KWDm8zQxUfzwZTGXA93CjZpjm L5xnkC55tMss//mpGNgNfnaL8ce1lwnUGrWTM6fLsI1FZyfgb35ToIIYXbM5/s/CnIGh p4EJ1EFLQy+reCiABVbs3oHFldYnaIYQwT6BJQ4GsLGpCYpeQWA7A27jUnc9qqXbgjjy xyapQ1FYCe8NVS4j7ayTmTw/I9hWA2uVPDCdJv4LIPbhPMa8SGjm/suM49KTae0mL2gP 1XzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XLVEdq1beggKVV19CkwRZ2oQdZeDQ5ckzgJNWjsO1ec=; fh=aZ0PVsr8S/ttRZ630UfSaeNQ7FmIzEn4qrFu0qaA0cw=; b=Clw+uXlP3XVDUWLIJLmZ5i0F2Ii8a4ef39lnvSzh0xnBl23eYmE1GdoyfyI0hanesA QsbHUouzzlZG5/zD+dBp03a6TTr/aNu1B/H9/L96okgX32PyONcnRVuCuVmMeIbu9qk2 7K8w34JivYFM/y/6Po8/W9uK+ksJaM5E9SbDGHI5Z2MwWP/hEBOUNdqB0DNF1rtfhAtl 6gfdoWgUjEp56ZCVq4lmNdMwNcijD23ppjHWuTdfn7a2T3+YweSrxAhKgWEA+M0tVVDr y6rpf0vtv3hOH2xxmV6gDlzC+z7jR48m4m7iKfISuXzBb528l7+1s8IklNihn8WnIvGb fvaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="EDnRus/7"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i190-20020a6387c7000000b00541a9b822cdsi4557009pge.520.2023.06.25.23.06.20; Sun, 25 Jun 2023 23:06:32 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="EDnRus/7"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229844AbjFZFwM (ORCPT + 99 others); Mon, 26 Jun 2023 01:52:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbjFZFwJ (ORCPT ); Mon, 26 Jun 2023 01:52:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C980FE43; Sun, 25 Jun 2023 22:52:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3CA3060C83; Mon, 26 Jun 2023 05:52:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39EA9C433C0; Mon, 26 Jun 2023 05:52:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1687758725; bh=Q/Jx4hUMTo4PbW0+37Rx0hnjf5b3/J11HUc9EDQu0M8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EDnRus/73cUBJt1KENvBFHrmmhm+JYVyU2VV816M7TP16lKsYV+74Dmn3a78QfEBT 1NhFxG8a2NJTiP76ziq0ougRA33fMSL3T2zGU8j3OlOzxrkOXMdeoI2mVa5GPj60Bx zcmX2JnnEnKzhswXn0t/0MVsGHKsCDtWZUJGByko= Date: Mon, 26 Jun 2023 07:52:02 +0200 From: Greg KH To: Jan Beulich , Zhang Shurong Cc: xen-devel@lists.xenproject.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, jgross@suse.com Subject: Re: [PATCH] xen: fix potential shift out-of-bounds in xenhcd_hub_control() Message-ID: <2023062628-shame-ebook-56f2@gregkh> References: <1c8ff405-2bfe-37ff-42ba-aa4f81853475@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1c8ff405-2bfe-37ff-42ba-aa4f81853475@suse.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Mon, Jun 26, 2023 at 07:48:05AM +0200, Jan Beulich wrote: > On 25.06.2023 18:42, Zhang Shurong wrote: > > --- a/drivers/usb/host/xen-hcd.c > > +++ b/drivers/usb/host/xen-hcd.c > > @@ -456,6 +456,8 @@ static int xenhcd_hub_control(struct usb_hcd *hcd, __u16 typeReq, __u16 wValue, > > info->ports[wIndex - 1].c_connection = false; > > fallthrough; > > default: > > + if (wValue >= 32) > > + goto error; > > info->ports[wIndex - 1].status &= ~(1 << wValue); > > Even 31 is out of bounds (as in: UB) as long as it's 1 here rather > than 1u. Why isn't the caller fixed so this type of value could never be passed to the hub_control callback? thanks, greg k-h